diff --git a/WPAppInstall/WPAppInstall/App.config b/WPAppInstall/WPAppInstall/App.config
index ecdcf8a..0a564f8 100644
--- a/WPAppInstall/WPAppInstall/App.config
+++ b/WPAppInstall/WPAppInstall/App.config
@@ -1,6 +1,6 @@
-
+
-
+
diff --git a/WPAppInstall/WPAppInstall/App.xaml.cs b/WPAppInstall/WPAppInstall/App.xaml.cs
index 6b51fec..3ce1f51 100644
--- a/WPAppInstall/WPAppInstall/App.xaml.cs
+++ b/WPAppInstall/WPAppInstall/App.xaml.cs
@@ -1,15 +1,41 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Configuration;
using System.Data;
+using System.IO;
using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows;
+using WPAppInstall.Misc;
namespace WPAppInstall
{
- public partial class App : Application
+ public partial class App : System.Windows.Application
{
+ private const String phoneRegDll = "PhoneRegDll.dll";
+ ///
+ /// Load embedded assemblies.
+ ///
+ [STAThread]
+ public static void Main()
+ {
+ EmbeddedAssemblyLoader embeddedAssemblyLoader = new EmbeddedAssemblyLoader();
+ embeddedAssemblyLoader.LoadUnmanagedLibraryFromResource(phoneRegDll);
+ StartProgram();
+ }
+
+ ///
+ /// Called after loading the neccessary assemblies.
+ ///
+ public static void StartProgram()
+ {
+ var application = new App();
+ application.InitializeComponent();
+ application.Run();
+ }
}
}
diff --git a/WPAppInstall/WPAppInstall/Fragments/Apps.cs b/WPAppInstall/WPAppInstall/Fragments/Apps.cs
index 424403e..3875877 100644
--- a/WPAppInstall/WPAppInstall/Fragments/Apps.cs
+++ b/WPAppInstall/WPAppInstall/Fragments/Apps.cs
@@ -1,10 +1,7 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.Threading;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@@ -17,14 +14,16 @@ namespace WPAppInstall.Fragments
///
/// This class builds the view / window to browse and display apps.
///
-
public class Apps : IFragment
{
- private readonly StackPanel _rootPanel = new StackPanel();
- private readonly String _wp81FileExtension = "{0}|*.xap;*.appx;*.appxbundle";
- private Grid _applicationsGrid = new Grid();
- private int _applicationGridRowIndex = 0;
-
+ private readonly StackPanel rootPanel = new StackPanel();
+ private readonly String wp81FileExtension = "{0}|*.xap;*.appx;*.appxbundle";
+ private Grid applicationsGrid = new Grid();
+ private Int32 applicationGridRowIndex = 0;
+
+ ///
+ /// Build the view / window to browse and display apps.
+ ///
public Apps()
{
// Browse Apps Section
@@ -40,7 +39,7 @@ public Apps()
{
Content = deploymentAppsTextblock
};
- _rootPanel.Children.Add(deploymentAppsLabel);
+ rootPanel.Children.Add(deploymentAppsLabel);
Button deploymentAppsButton = new Button
{
@@ -49,7 +48,7 @@ public Apps()
HorizontalAlignment = HorizontalAlignment.Left
};
deploymentAppsButton.Click += DeploymentAppsButton_Click;
- _rootPanel.Children.Add(deploymentAppsButton);
+ rootPanel.Children.Add(deploymentAppsButton);
// Apps List
TextBlock appListTextblock = new TextBlock
@@ -64,7 +63,7 @@ public Apps()
{
Content = appListTextblock
};
- _rootPanel.Children.Add(appListLabel);
+ rootPanel.Children.Add(appListLabel);
Button appListButton = new Button
{
@@ -73,71 +72,82 @@ public Apps()
HorizontalAlignment = HorizontalAlignment.Left
};
appListButton.Click += AppListButton_Click;
- _rootPanel.Children.Add(appListButton);
+ rootPanel.Children.Add(appListButton);
ColumnDefinition appName = new ColumnDefinition();
ColumnDefinition appPath = new ColumnDefinition();
ColumnDefinition appGuid = new ColumnDefinition();
- _applicationsGrid.ColumnDefinitions.Add(appName);
- //_applicationsGrid.ColumnDefinitions.Add(appPath);
- _applicationsGrid.ColumnDefinitions.Add(appGuid);
+ applicationsGrid.ColumnDefinitions.Add(appName);
+ applicationsGrid.ColumnDefinitions.Add(appGuid);
- _applicationsGrid.Background = new SolidColorBrush(Colors.Black);
- _rootPanel.Children.Add(_applicationsGrid);
+ applicationsGrid.Background = new SolidColorBrush(Colors.Black);
+ rootPanel.Children.Add(applicationsGrid);
- if (Misc.Application.Lifecycle.paths.Length > 0) FillInfo();
+ if (Misc.Application.Lifecycle.Paths.Length > 0) FillInfo();
}
+ ///
+ /// On click clear and (re)load the list of apps.
+ ///
private void AppListButton_Click(object sender, RoutedEventArgs e)
{
- _applicationsGrid.Children.Clear();
- _applicationGridRowIndex = 0;
- Misc.Application.Lifecycle.manifestInfoList = new Microsoft.Phone.Tools.Deploy.IAppManifestInfo[0];
- Misc.Application.Lifecycle.paths = new String[0];
+ applicationsGrid.Children.Clear();
+ applicationGridRowIndex = 0;
+ Misc.Application.Lifecycle.ManifestInfoList = new Microsoft.Phone.Tools.Deploy.IAppManifestInfo[0];
+ Misc.Application.Lifecycle.Paths = new String[0];
}
+ ///
+ /// Open a file picker to select the applications to deploy.
+ ///
private void DeploymentAppsButton_Click(object sender, RoutedEventArgs e)
{
OpenFilePicker();
}
+ ///
+ /// Get the root of this view for displaying purposes.
+ ///
+ /// Root of this view.
public StackPanel GetRoot()
{
- return _rootPanel;
+ return rootPanel;
}
+ ///
+ /// Fill the application grid.
+ ///
private void FillInfo()
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
- _applicationsGrid.Children.Clear();
- _applicationGridRowIndex = 0;
+ applicationsGrid.Children.Clear();
+ applicationGridRowIndex = 0;
- for (int i = 0; i < Misc.Application.Lifecycle.manifestInfoList.Length; i++)
+ for (int i = 0; i < Misc.Application.Lifecycle.ManifestInfoList.Length; i++)
{
RowDefinition row = new RowDefinition();
- _applicationsGrid.RowDefinitions.Add(row);
+ applicationsGrid.RowDefinitions.Add(row);
Label appName = new Label
{
- Content = Misc.Application.Lifecycle.manifestInfoList[i].Name
+ Content = Misc.Application.Lifecycle.ManifestInfoList[i].Name
};
Label appPath = new Label
{
- Content = Misc.Application.Lifecycle.paths[i].ToString()
+ Content = Misc.Application.Lifecycle.Paths[i].ToString()
};
Label appGuid = new Label
{
- Content = Misc.Application.Lifecycle.manifestInfoList[i].ProductId.ToString()
+ Content = Misc.Application.Lifecycle.ManifestInfoList[i].ProductId.ToString()
};
- _applicationsGrid.Children.Add(appName);
- //_applicationsGrid.Children.Add(appPath);
- _applicationsGrid.Children.Add(appGuid);
+ applicationsGrid.Children.Add(appName);
+ applicationsGrid.Children.Add(appGuid);
appName.Background = new SolidColorBrush(Colors.White);
appPath.Background = new SolidColorBrush(Colors.White);
@@ -148,7 +158,7 @@ private void FillInfo()
if (i==0)
topMargin = 1;
- if (i==Misc.Application.Lifecycle.manifestInfoList.Length-1)
+ if (i==Misc.Application.Lifecycle.ManifestInfoList.Length-1)
bottomMargin = 1;
appName.Margin = new Thickness(1, topMargin, 0, bottomMargin);
@@ -156,30 +166,32 @@ private void FillInfo()
appGuid.Margin = new Thickness(0, topMargin, 1, bottomMargin);
appName.SetValue(Grid.ColumnProperty, 0);
- appName.SetValue(Grid.RowProperty, _applicationGridRowIndex);
+ appName.SetValue(Grid.RowProperty, applicationGridRowIndex);
appPath.SetValue(Grid.ColumnProperty, 1);
- appPath.SetValue(Grid.RowProperty, _applicationGridRowIndex);
+ appPath.SetValue(Grid.RowProperty, applicationGridRowIndex);
appGuid.SetValue(Grid.ColumnProperty, 2);
- appGuid.SetValue(Grid.RowProperty, _applicationGridRowIndex);
+ appGuid.SetValue(Grid.RowProperty, applicationGridRowIndex);
- _applicationGridRowIndex++;
+ applicationGridRowIndex++;
}
}));
}
+ ///
+ /// Open a file picker to select the applications to deploy.
+ ///
private void OpenFilePicker()
{
OpenFileDialog openFileDialog = new OpenFileDialog
{
Multiselect = true,
Title = Resources.Strings.AppStrings.DEPLOY_SELECT_APPS,
-
- Filter = String.Format(_wp81FileExtension, Resources.Strings.AppStrings.DEPLOY_WP81_XAP_EXTENSION)
+ Filter = String.Format(wp81FileExtension, Resources.Strings.AppStrings.DEPLOY_WP81_XAP_EXTENSION)
};
- bool? flag = openFileDialog.ShowDialog();
+ Boolean? flag = openFileDialog.ShowDialog();
if (flag != null && flag.Value)
{
@@ -189,7 +201,7 @@ private void OpenFilePicker()
List manifestList = new List();
List pathList = new List();
- for (int i = 0; i < paths.Length; i++)
+ for (Int32 i = 0; i < paths.Length; i++)
{
try
{
@@ -203,17 +215,19 @@ private void OpenFilePicker()
}));
}
}
- Misc.Application.Lifecycle.manifestInfoList = manifestList.ToArray();
- Misc.Application.Lifecycle.paths = pathList.ToArray();
+ Misc.Application.Lifecycle.ManifestInfoList = manifestList.ToArray();
+ Misc.Application.Lifecycle.Paths = pathList.ToArray();
FillInfo();
}).Start();
-
-
}
}
+ ///
+ /// Show an error dialog for when reading the applications fails.
+ ///
+ /// Error to display.
private void ShowErrorDialog(String error)
{
BitmapImage errorImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_ERROR, Misc.Image.Extensions.png);
diff --git a/WPAppInstall/WPAppInstall/Fragments/Deploy.cs b/WPAppInstall/WPAppInstall/Fragments/Deploy.cs
index 0608cbc..a60abd5 100644
--- a/WPAppInstall/WPAppInstall/Fragments/Deploy.cs
+++ b/WPAppInstall/WPAppInstall/Fragments/Deploy.cs
@@ -21,25 +21,24 @@ namespace WPAppInstall.Fragments
///
/// This class builds the view / window to deploy apps.
///
-
public class Deploy : IFragment
{
- private readonly StackPanel _rootPanel = new StackPanel();
-
-
- private const String _deployerLatest = "Latest (Windows Phone 8.1)";
-
- private Deployer _selectedDeployer = Deployer.Latest;
- private Microsoft.Phone.Tools.Deploy.DeploymentOptions _selectedDeploymentOption = Microsoft.Phone.Tools.Deploy.DeploymentOptions.None;
- private String _xapPath = String.Empty;
- private Microsoft.Phone.Tools.Deploy.DeviceInfo _selectedDeviceInfo;
- private Microsoft.Phone.Tools.Deploy.DeviceInfo[] _devicesInfo;
- private DialogPopup _deployDialog;
-
+ private readonly StackPanel rootPanel = new StackPanel();
+ private const String deployerLatest = "Latest (Windows Phone 8.1)";
+ private Deployer selectedDeployer = Deployer.Latest;
+ private Microsoft.Phone.Tools.Deploy.DeploymentOptions selectedDeploymentOption = Microsoft.Phone.Tools.Deploy.DeploymentOptions.None;
+ private String xapPath = String.Empty;
+ private Microsoft.Phone.Tools.Deploy.DeviceInfo selectedDeviceInfo;
+ private Microsoft.Phone.Tools.Deploy.DeviceInfo[] devicesInfo;
+ private DialogPopup deployDialog;
+
+ ///
+ /// Build the view or page that is used for deploying applications.
+ ///
public Deploy()
{
// Main panel
- _rootPanel.Orientation = Orientation.Vertical;
+ rootPanel.Orientation = Orientation.Vertical;
// Deploy version picker
StackPanel deployPicker = new StackPanel
@@ -47,7 +46,7 @@ public Deploy()
Orientation = Orientation.Vertical,
Background = new SolidColorBrush(Colors.Transparent)
};
- _rootPanel.Children.Add(deployPicker);
+ rootPanel.Children.Add(deployPicker);
// Deployer Selector Section
TextBlock deployerSelectorTextblock = new TextBlock
@@ -70,7 +69,7 @@ public Deploy()
HorizontalAlignment = HorizontalAlignment.Left,
IsEditable = true,
IsReadOnly = true,
- SelectedItem = GetDeployerString(_selectedDeployer)
+ SelectedItem = GetDeployerString(selectedDeployer)
};
deployerSelectorCombobox.Items.Add(GetDeployerString(Deployer.Latest));
deployerSelectorCombobox.SelectionChanged += DeployerSelectorCombobox_SelectionChanged;
@@ -97,7 +96,7 @@ public Deploy()
HorizontalAlignment = HorizontalAlignment.Left,
IsEditable = true,
IsReadOnly = true,
- SelectedItem = GetDeploymentOptionString(_selectedDeploymentOption)
+ SelectedItem = GetDeploymentOptionString(selectedDeploymentOption)
};
foreach (Microsoft.Phone.Tools.Deploy.DeploymentOptions deploymentOption in (Microsoft.Phone.Tools.Deploy.DeploymentOptions[])Enum.GetValues(typeof(Microsoft.Phone.Tools.Deploy.DeploymentOptions)))
deploymentOptionCombobox.Items.Add(GetDeploymentOptionString(deploymentOption));
@@ -126,13 +125,13 @@ public Deploy()
IsEditable = true,
IsReadOnly = true
};
- _devicesInfo = Microsoft.Phone.Tools.Deploy.Utils.GetDevices();
- if (_devicesInfo.Length > 0)
+ devicesInfo = Microsoft.Phone.Tools.Deploy.Utils.GetDevices();
+ if (devicesInfo.Length > 0)
{
- _selectedDeviceInfo = _devicesInfo[0];
- selectedDevicesCombobox.SelectedItem = _selectedDeviceInfo;
+ selectedDeviceInfo = devicesInfo[0];
+ selectedDevicesCombobox.SelectedItem = selectedDeviceInfo;
}
- foreach (Microsoft.Phone.Tools.Deploy.DeviceInfo device in _devicesInfo)
+ foreach (Microsoft.Phone.Tools.Deploy.DeviceInfo device in devicesInfo)
selectedDevicesCombobox.Items.Add(device);
selectedDevicesCombobox.SelectionChanged += SelectedDevicesCombobox_SelectionChanged;
deployPicker.Children.Add(selectedDevicesCombobox);
@@ -154,7 +153,7 @@ public Deploy()
Label deploymentAppsCountLabel = new Label
{
- Content = Misc.Application.Lifecycle.paths.Length.ToString()
+ Content = Misc.Application.Lifecycle.Paths.Length.ToString()
};
deployPicker.Children.Add(deploymentAppsCountLabel);
@@ -192,20 +191,29 @@ public Deploy()
deployPicker.Children.Add(deploymentDevicesButton);
}
+ ///
+ /// Change the selected device when the selection of the combobox changed.
+ ///
private void SelectedDevicesCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- _selectedDeviceInfo = (Microsoft.Phone.Tools.Deploy.DeviceInfo)((ComboBox)sender).SelectedItem;
+ selectedDeviceInfo = (Microsoft.Phone.Tools.Deploy.DeviceInfo)((ComboBox)sender).SelectedItem;
}
+ ///
+ /// When checked, applications should be launched after installation.
+ ///
private void DeploymentDevicesLaunchCheckbox_Checked(object sender, RoutedEventArgs e)
{
bool launchAfterInstall = ((CheckBox)sender).IsChecked.Value;
Misc.Application.Lifecycle.Hardware81.SetLaunchAppAfterInstall(launchAfterInstall);
}
+ ///
+ /// When clicked, deploy the applications to the selected device.
+ ///
private void DeployAppsButton_Click(object sender, RoutedEventArgs e)
{
- if (_selectedDeviceInfo == _devicesInfo[0] && Misc.Application.Lifecycle.DevicesUSB.Count == 0)
+ if (selectedDeviceInfo == devicesInfo[0] && Misc.Application.Lifecycle.DevicesUSB.Count == 0)
{
BitmapImage warningImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_WARNING, Misc.Image.Extensions.png);
DialogPopup dialogPopup = new DialogPopup(AppStrings.MANAGER_WARNING, AppStrings.MANAGER_CONNECT_DEVICE, null, DialogPopup.DefaultButtons.Ok, warningImage, false);
@@ -213,7 +221,7 @@ private void DeployAppsButton_Click(object sender, RoutedEventArgs e)
return;
}
- if (Misc.Application.Lifecycle.DevicesUSB.Count > 1 && _selectedDeviceInfo == _devicesInfo[0])
+ if (Misc.Application.Lifecycle.DevicesUSB.Count > 1 && selectedDeviceInfo == devicesInfo[0])
{
BitmapImage warningImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_WARNING, Misc.Image.Extensions.png);
DialogPopup dialogPopup = new DialogPopup(AppStrings.MANAGER_WARNING, AppStrings.MANAGER_DISCONNECT_DEVICES, null, DialogPopup.DefaultButtons.Ok, warningImage, false);
@@ -221,9 +229,14 @@ private void DeployAppsButton_Click(object sender, RoutedEventArgs e)
return;
}
- DeployApps(Misc.Application.Lifecycle.manifestInfoList, Misc.Application.Lifecycle.paths);
+ DeployApps(Misc.Application.Lifecycle.ManifestInfoList, Misc.Application.Lifecycle.Paths);
}
+ ///
+ /// Deploy the applications to the selected device.
+ ///
+ /// Manifest information for the applications
+ /// Paths list for the applications
private void DeployApps(Microsoft.Phone.Tools.Deploy.IAppManifestInfo[] appManifestList, String[] paths)
{
new Thread(() =>
@@ -232,8 +245,8 @@ private void DeployApps(Microsoft.Phone.Tools.Deploy.IAppManifestInfo[] appManif
Application.Current.Dispatcher.Invoke(() =>
{
BitmapImage infoImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_TIP, Misc.Image.Extensions.png);
- _deployDialog = new DialogPopup(AppStrings.MANAGER_INFO, String.Empty, null, DialogPopup.DefaultButtons.None, infoImage, false);
- _deployDialog.Show();
+ deployDialog = new DialogPopup(AppStrings.MANAGER_INFO, String.Empty, null, DialogPopup.DefaultButtons.None, infoImage, false);
+ deployDialog.Show();
});
@@ -243,11 +256,11 @@ private void DeployApps(Microsoft.Phone.Tools.Deploy.IAppManifestInfo[] appManif
{
String dialogText = AppStrings.MANAGER__INSTALLING_APPS + "\n" + AppStrings.MANAGER_INSTALLING_PROGRESS + (i + 1) + "/" + appManifestList.Length + "\n" + AppStrings.MANAGER_INSTALLING_APPLICATION + appManifestList[i].Name;
Console.WriteLine(dialogText);
- _deployDialog.EditText(dialogText);
+ deployDialog.EditText(dialogText);
});
- Microsoft.Phone.Tools.Deploy.DeviceInfo deviceInfo = _selectedDeviceInfo;
- Microsoft.Phone.Tools.Deploy.DeploymentOptions deploymentOptions = _selectedDeploymentOption;
+ Microsoft.Phone.Tools.Deploy.DeviceInfo deviceInfo = selectedDeviceInfo;
+ Microsoft.Phone.Tools.Deploy.DeploymentOptions deploymentOptions = selectedDeploymentOption;
try
{
@@ -263,37 +276,55 @@ private void DeployApps(Microsoft.Phone.Tools.Deploy.IAppManifestInfo[] appManif
}
Application.Current.Dispatcher.Invoke(new Action(() =>
{
- _deployDialog.Close();
+ deployDialog.Close();
}));
}).Start();
}
+ ///
+ /// Update the textbox for the selected app path.
+ ///
private void AppDeployBox_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox xapBox = (TextBox)sender;
- _xapPath = xapBox.Text;
+ xapPath = xapBox.Text;
}
+ ///
+ /// Change the selected deployment option when the selection of the combobox changed.
+ ///
private void DeploymentOptionCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Microsoft.Phone.Tools.Deploy.DeploymentOptions? deploymentOption = FromDeploymentOptionString(((ComboBox)sender).SelectedItem.ToString());
if (deploymentOption != null)
- _selectedDeploymentOption = (Microsoft.Phone.Tools.Deploy.DeploymentOptions)deploymentOption;
+ selectedDeploymentOption = (Microsoft.Phone.Tools.Deploy.DeploymentOptions)deploymentOption;
}
+ ///
+ /// Select the deployer version (currently only the Windows Phone 8.1 deployer is supported).
+ ///
private void DeployerSelectorCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Deployer? deployer = FromDeployerString(((ComboBox)sender).SelectedItem.ToString());
if (deployer != null)
- _selectedDeployer = (Deployer)deployer;
+ selectedDeployer = (Deployer)deployer;
}
+ ///
+ /// Get the selected deployment option as a string.
+ ///
+ /// Deployment option as string.
private String GetDeploymentOptionString(Microsoft.Phone.Tools.Deploy.DeploymentOptions deploymentOption)
{
return deploymentOption.ToString();
}
-
+
+ ///
+ /// Convert a String to a deployment option.
+ ///
+ /// String that represents the deployment option.
+ /// Enum type of the deployment option.
private Microsoft.Phone.Tools.Deploy.DeploymentOptions? FromDeploymentOptionString(String deploymentOption)
{
Object value = Enum.Parse(typeof(Microsoft.Phone.Tools.Deploy.DeploymentOptions), deploymentOption);
@@ -303,50 +334,48 @@ private String GetDeploymentOptionString(Microsoft.Phone.Tools.Deploy.Deployment
return null;
}
+ ///
+ /// Get the selected deployer as a String.
+ ///
+ /// Deployer enum type.
+ /// String that represents the deployer option.
private String GetDeployerString(Deployer deployer)
{
switch (deployer)
{
case Deployer.Latest:
- return _deployerLatest;
+ return deployerLatest;
}
return String.Empty;
}
+ ///
+ /// Get the selected deployer as an enum type.
+ ///
+ /// String that represents the deployer option.
+ /// Enum type of the deployer option.
private Deployer? FromDeployerString(String deployer)
{
switch (deployer)
{
- case _deployerLatest:
+ case deployerLatest:
return Deployer.Latest;
}
return null;
}
+ ///
+ /// Enum of the deployer option.
+ ///
private enum Deployer
{
Latest
}
- private void SelectButton(Button button)
- {
- button.BorderThickness = new Thickness(0, 0, 0, 5);
- }
-
- private void DeselectButton(Button button)
- {
- button.BorderThickness = new Thickness(0, 0, 0, 0);
- }
-
- private Separator GetSeparator()
- {
- Separator separator = new Separator();
- separator.Style = (System.Windows.Style)separator.FindResource(ToolBar.SeparatorStyleKey);
- return separator;
- }
-
-
-
+ ///
+ /// Show an error dialog for when deployment failed.
+ ///
+ /// Error to display.
private void ShowErrorDialog(String error)
{
BitmapImage errorImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_ERROR, Misc.Image.Extensions.png);
@@ -354,9 +383,13 @@ private void ShowErrorDialog(String error)
dialogPopup.Show();
}
+ ///
+ /// Get the root of this view for displaying purposes.
+ ///
+ /// Root of this view.
public StackPanel GetRoot()
{
- return _rootPanel;
+ return rootPanel;
}
}
}
diff --git a/WPAppInstall/WPAppInstall/Fragments/Devices.cs b/WPAppInstall/WPAppInstall/Fragments/Devices.cs
index ff3c2a7..3e935b7 100644
--- a/WPAppInstall/WPAppInstall/Fragments/Devices.cs
+++ b/WPAppInstall/WPAppInstall/Fragments/Devices.cs
@@ -15,12 +15,14 @@ namespace WPAppInstall.Fragments
///
/// This class builds the view / window to view devices.
///
-
public class Devices : IFragment
{
- private readonly StackPanel _rootPanel = new StackPanel();
- private readonly Label _startLabel = new Label();
+ private readonly StackPanel rootPanel = new StackPanel();
+ private readonly Label startLabel = new Label();
+ ///
+ /// Build the view that contains the various (USB) devices.
+ ///
public Devices()
{
foreach (USBScanner.USBDevice device in Misc.Application.Lifecycle.DevicesUSB)
@@ -32,10 +34,10 @@ public Devices()
StackPanel devicePanel = new StackPanel();
- USBConnectionHandler.USBDevice usbDeviceProperty = new USBConnectionHandler.USBDevice(device.pnpDeviceId);
+ USBConnectionHandler.USBDevice usbDeviceProperty = new USBConnectionHandler.USBDevice(device.PnpDeviceId);
- String vid = $"{AppStrings.HARDWARE_USB_VID}: {usbDeviceProperty.vendorId}";
- String pid = $"{AppStrings.HARDWARE_USB_PID}: {usbDeviceProperty.productId}";
+ String vid = $"{AppStrings.HARDWARE_USB_VID}: {usbDeviceProperty.VendorId}";
+ String pid = $"{AppStrings.HARDWARE_USB_PID}: {usbDeviceProperty.ProductId}";
Label deviceName = new Label();
Label deviceManufacturer = new Label();
@@ -48,33 +50,26 @@ public Devices()
Label deviceCaption = new Label();
Label deviceGUID = new Label();
Label deviceStatus = new Label();
- Button deviceDetails = new Button();
Image deviceImage = new Image();
- deviceName.Content = $"Name: {device.name}";
- deviceManufacturer.Content = $"Manufacturer: {device.manufacturer}";
- deviceDescription.Content = $"Description: {device.description}";
- deviceService.Content = $"Service: {device.service}";
- devicePNPClass.Content = $"PNPClass: {device.pnpClass}";
- devicePNPID.Content = $"PNPID: {device.pnpDeviceId}";
+ deviceName.Content = $"Name: {device.Name}";
+ deviceManufacturer.Content = $"Manufacturer: {device.Manufacturer}";
+ deviceDescription.Content = $"Description: {device.Description}";
+ deviceService.Content = $"Service: {device.Service}";
+ devicePNPClass.Content = $"PNPClass: {device.PnpClass}";
+ devicePNPID.Content = $"PNPID: {device.PnpDeviceId}";
deviceVID.Content = vid;
devicePID.Content = pid;
- deviceCaption.Content = $"Caption: {device.caption}";
- deviceGUID.Content = $"GUID: {device.classGuid}";
- deviceStatus.Content = $"Status: {device.status}";
+ deviceCaption.Content = $"Caption: {device.Caption}";
+ deviceGUID.Content = $"GUID: {device.ClassGuid}";
+ deviceStatus.Content = $"Status: {device.Status}";
deviceName.FontFamily = new System.Windows.Media.FontFamily(Misc.Application.Text.FONT);
deviceManufacturer.FontFamily = new System.Windows.Media.FontFamily(Misc.Application.Text.FONT);
deviceName.FontWeight = FontWeights.Bold;
- CheckBox deployToDevice = new CheckBox
- {
- Content = $"Deploy to {device.name}",
- Margin = new Thickness(5, 0, 0, 0)
- };
-
- BitmapFrame image = Misc.Image.GetDeviceImage(device.pnpDeviceId);
+ BitmapFrame image = Misc.Image.GetDeviceImage(device.PnpDeviceId);
if (image != null)
{
@@ -85,7 +80,6 @@ public Devices()
devicePanel.Children.Add(new Separator());
devicePanel.Children.Add(deviceName);
- //devicePanel.Children.Add(deployToDevice);
devicePanel.Children.Add(deviceManufacturer);
devicePanel.Children.Add(deviceDescription);
devicePanel.Children.Add(deviceService);
@@ -101,18 +95,17 @@ public Devices()
horizontalPanel.Children.Add(deviceImage);
horizontalPanel.Children.Add(devicePanel);
- _rootPanel.Children.Add(horizontalPanel);
+ rootPanel.Children.Add(horizontalPanel);
}
}
+ ///
+ /// Get the root of this view for displaying purposes.
+ ///
+ /// Root of this view.
public StackPanel GetRoot()
{
- return _rootPanel;
- }
-
- public void Update(List devices)
- {
-
+ return rootPanel;
}
}
}
diff --git a/WPAppInstall/WPAppInstall/Fragments/Manager.cs b/WPAppInstall/WPAppInstall/Fragments/Manager.cs
index b34e63d..076b8be 100644
--- a/WPAppInstall/WPAppInstall/Fragments/Manager.cs
+++ b/WPAppInstall/WPAppInstall/Fragments/Manager.cs
@@ -16,17 +16,19 @@ namespace WPAppInstall.Fragments
///
/// This class builds the view / window to read phone data (manager).
///
-
public class Manager : IFragment
{
- private StackPanel _stackPanel = new StackPanel();
- private Microsoft.Phone.Tools.Deploy.DeviceInfo _selectedDeviceInfo;
- private Microsoft.Phone.Tools.Deploy.DeviceInfo[] _devicesInfo;
- private Grid _deviceSpecificationsGrid = new Grid();
- private Grid _deviceApplicationsGrid = new Grid();
- private int _specificationRowIndex = 0;
- private int _applicationRowIndex = 0;
-
+ private StackPanel stackPanel = new StackPanel();
+ private Microsoft.Phone.Tools.Deploy.DeviceInfo selectedDeviceInfo;
+ private Microsoft.Phone.Tools.Deploy.DeviceInfo[] devicesInfo;
+ private Grid deviceSpecificationsGrid = new Grid();
+ private Grid deviceApplicationsGrid = new Grid();
+ private Int32 specificationRowIndex = 0;
+ private Int32 applicationRowIndex = 0;
+
+ ///
+ /// Build the view or page that is used for managing installed applications.
+ ///
public Manager()
{
// Read section
@@ -42,7 +44,7 @@ public Manager()
{
Content = managerReadTextblock
};
- _stackPanel.Children.Add(managerReadLabel);
+ stackPanel.Children.Add(managerReadLabel);
ComboBox managerDeviceCombobox = new ComboBox
{
@@ -51,16 +53,16 @@ public Manager()
IsEditable = true,
IsReadOnly = true
};
- _devicesInfo = Microsoft.Phone.Tools.Deploy.Utils.GetDevices();
- if (_devicesInfo.Length > 0)
+ devicesInfo = Microsoft.Phone.Tools.Deploy.Utils.GetDevices();
+ if (devicesInfo.Length > 0)
{
- _selectedDeviceInfo = _devicesInfo[0];
- managerDeviceCombobox.SelectedItem = _selectedDeviceInfo;
+ selectedDeviceInfo = devicesInfo[0];
+ managerDeviceCombobox.SelectedItem = selectedDeviceInfo;
}
- foreach (Microsoft.Phone.Tools.Deploy.DeviceInfo device in _devicesInfo)
+ foreach (Microsoft.Phone.Tools.Deploy.DeviceInfo device in devicesInfo)
managerDeviceCombobox.Items.Add(device);
managerDeviceCombobox.SelectionChanged += ManagerDeviceCombobox_SelectionChanged; ;
- _stackPanel.Children.Add(managerDeviceCombobox);
+ stackPanel.Children.Add(managerDeviceCombobox);
Button managerReadButton = new Button
{
@@ -70,7 +72,7 @@ public Manager()
Margin = new Thickness(0, 10, 0, 0)
};
managerReadButton.Click += ManagerReadButton_Click;
- _stackPanel.Children.Add(managerReadButton);
+ stackPanel.Children.Add(managerReadButton);
// Device Specs Grid
TextBlock deviceSpecificationsTextblock = new TextBlock
@@ -85,13 +87,13 @@ public Manager()
{
Content = deviceSpecificationsTextblock
};
- _stackPanel.Children.Add(deviceSpecificationsLabel);
+ stackPanel.Children.Add(deviceSpecificationsLabel);
ColumnDefinition deviceSpecification = new ColumnDefinition();
ColumnDefinition deviceValue = new ColumnDefinition();
- _deviceSpecificationsGrid.ColumnDefinitions.Add(deviceSpecification);
- _deviceSpecificationsGrid.ColumnDefinitions.Add(deviceValue);
- _stackPanel.Children.Add(_deviceSpecificationsGrid);
+ deviceSpecificationsGrid.ColumnDefinitions.Add(deviceSpecification);
+ deviceSpecificationsGrid.ColumnDefinitions.Add(deviceValue);
+ stackPanel.Children.Add(deviceSpecificationsGrid);
// Device Apps Grid
TextBlock deviceApplicationsTextblock = new TextBlock
@@ -106,27 +108,33 @@ public Manager()
{
Content = deviceApplicationsTextblock
};
- _stackPanel.Children.Add(deviceApplicationsLabel);
+ stackPanel.Children.Add(deviceApplicationsLabel);
ColumnDefinition appId = new ColumnDefinition();
ColumnDefinition appLaunchButton = new ColumnDefinition();
ColumnDefinition appTerminateButton = new ColumnDefinition();
ColumnDefinition appUninstallButton = new ColumnDefinition();
- _deviceApplicationsGrid.ColumnDefinitions.Add(appId);
- _deviceApplicationsGrid.ColumnDefinitions.Add(appLaunchButton);
- _deviceApplicationsGrid.ColumnDefinitions.Add(appTerminateButton);
- _deviceApplicationsGrid.ColumnDefinitions.Add(appUninstallButton);
- _stackPanel.Children.Add(_deviceApplicationsGrid);
+ deviceApplicationsGrid.ColumnDefinitions.Add(appId);
+ deviceApplicationsGrid.ColumnDefinitions.Add(appLaunchButton);
+ deviceApplicationsGrid.ColumnDefinitions.Add(appTerminateButton);
+ deviceApplicationsGrid.ColumnDefinitions.Add(appUninstallButton);
+ stackPanel.Children.Add(deviceApplicationsGrid);
}
+ ///
+ /// Change the selected device when the selection of the combobox changed.
+ ///
private void ManagerDeviceCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- _selectedDeviceInfo = (Microsoft.Phone.Tools.Deploy.DeviceInfo)((ComboBox)sender).SelectedItem;
+ selectedDeviceInfo = (Microsoft.Phone.Tools.Deploy.DeviceInfo)((ComboBox)sender).SelectedItem;
}
+ ///
+ /// Read the device specifications and installed applications.
+ ///
private void ManagerReadButton_Click(object sender, RoutedEventArgs e)
{
- if (_selectedDeviceInfo == _devicesInfo[0] && Misc.Application.Lifecycle.DevicesUSB.Count == 0)
+ if (selectedDeviceInfo == devicesInfo[0] && Misc.Application.Lifecycle.DevicesUSB.Count == 0)
{
BitmapImage warningImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_WARNING, Misc.Image.Extensions.png);
DialogPopup dialogPopup = new DialogPopup(AppStrings.MANAGER_WARNING, AppStrings.MANAGER_CONNECT_DEVICE, null, DialogPopup.DefaultButtons.Ok, warningImage, false);
@@ -138,12 +146,12 @@ private void ManagerReadButton_Click(object sender, RoutedEventArgs e)
DialogPopup infoDialogPopup = new DialogPopup(AppStrings.MANAGER_INFO, AppStrings.MANAGER_READING, null, DialogPopup.DefaultButtons.None, infoImage, false);
infoDialogPopup.Show();
- _deviceSpecificationsGrid.Children.Clear();
- _deviceApplicationsGrid.Children.Clear();
- _specificationRowIndex = 0;
- _applicationRowIndex = 0;
+ deviceSpecificationsGrid.Children.Clear();
+ deviceApplicationsGrid.Children.Clear();
+ specificationRowIndex = 0;
+ applicationRowIndex = 0;
- if (Misc.Application.Lifecycle.DevicesUSB.Count > 1 && _selectedDeviceInfo == _devicesInfo[0])
+ if (Misc.Application.Lifecycle.DevicesUSB.Count > 1 && selectedDeviceInfo == devicesInfo[0])
{
BitmapImage warningImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_WARNING, Misc.Image.Extensions.png);
DialogPopup dialogPopup = new DialogPopup(AppStrings.MANAGER_WARNING, AppStrings.MANAGER_DISCONNECT_DEVICES, null, DialogPopup.DefaultButtons.None, warningImage, false);
@@ -155,26 +163,20 @@ private void ManagerReadButton_Click(object sender, RoutedEventArgs e)
{
try
{
-
System.Collections.ObjectModel.Collection devices = Misc.Application.Lifecycle.Hardware81.ScanDevices();
Microsoft.SmartDevice.MultiTargeting.Connectivity.ConnectableDevice connectableDevice = null;
-
foreach (Microsoft.SmartDevice.MultiTargeting.Connectivity.ConnectableDevice device in devices)
- if (device.Name == _selectedDeviceInfo.ToString())
+ if (device.Name == selectedDeviceInfo.ToString())
{
connectableDevice = device;
break;
}
-
if (connectableDevice == null) return;
Microsoft.SmartDevice.Connectivity.Interface.IDevice deviceHandle = Misc.Application.Lifecycle.Hardware81.ConnectToDevice(connectableDevice);
-
System.Collections.ObjectModel.Collection apps = Misc.Application.Lifecycle.Hardware81.GetRemoteApplications(deviceHandle);
-
Application.Current.Dispatcher.Invoke(new Action(() =>
{
Microsoft.SmartDevice.Connectivity.Interface.ISystemInfo systemInfo = deviceHandle.GetSystemInfo();
-
AddSpecificationsGridEntry("Name", deviceHandle.Name);
AddSpecificationsGridEntry("Instruction Set", systemInfo.InstructionSet);
AddSpecificationsGridEntry("Architecture", systemInfo.ProcessorArchitecture);
@@ -186,16 +188,11 @@ private void ManagerReadButton_Click(object sender, RoutedEventArgs e)
AddSpecificationsGridEntry("Available Physical", systemInfo.AvailPhys.ToString());
AddSpecificationsGridEntry("Total Virtual", systemInfo.TotalVirtual.ToString());
AddSpecificationsGridEntry("Available Virtual", systemInfo.AvailVirtual.ToString());
-
foreach (Microsoft.SmartDevice.Connectivity.Interface.IRemoteApplication remoteApplication in apps)
AddApplicationsGridEntry(remoteApplication.ProductID.ToString(), remoteApplication);
-
infoDialogPopup.Close();
-
}));
-
deviceHandle.Disconnect();
-
} catch(Exception exception)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
@@ -203,92 +200,84 @@ private void ManagerReadButton_Click(object sender, RoutedEventArgs e)
ShowErrorDialog(exception.Message);
}));
}
-
}).Start();
-
-
}
+ ///
+ /// Add a device specification to the view.
+ ///
+ /// Device specification label.
+ /// Specification value.
private void AddSpecificationsGridEntry(String specification, String value)
{
-
RowDefinition row = new RowDefinition();
- _deviceSpecificationsGrid.RowDefinitions.Add(row);
-
+ deviceSpecificationsGrid.RowDefinitions.Add(row);
Label specificationLabel = new Label
{
Content = specification
};
-
Label valueLabel = new Label
{
Content = value
};
-
specificationLabel.SetValue(Grid.ColumnProperty, 0);
- specificationLabel.SetValue(Grid.RowProperty, _specificationRowIndex);
-
+ specificationLabel.SetValue(Grid.RowProperty, specificationRowIndex);
valueLabel.SetValue(Grid.ColumnProperty, 1);
- valueLabel.SetValue(Grid.RowProperty, _specificationRowIndex);
-
- _deviceSpecificationsGrid.Children.Add(specificationLabel);
- _deviceSpecificationsGrid.Children.Add(valueLabel);
-
- _specificationRowIndex++;
+ valueLabel.SetValue(Grid.RowProperty, specificationRowIndex);
+ deviceSpecificationsGrid.Children.Add(specificationLabel);
+ deviceSpecificationsGrid.Children.Add(valueLabel);
+ specificationRowIndex++;
}
+ ///
+ /// Add an application to the grid.
+ ///
+ /// App that should be displayed.
+ /// Remote application.
private void AddApplicationsGridEntry(String appId, Microsoft.SmartDevice.Connectivity.Interface.IRemoteApplication remoteApplication)
{
-
RowDefinition row = new RowDefinition();
- _deviceApplicationsGrid.RowDefinitions.Add(row);
-
+ deviceApplicationsGrid.RowDefinitions.Add(row);
Label appIdLabel = new Label
{
Content = appId
};
-
Button launchAppButton = new Button
{
Content = "Launch",
Tag = remoteApplication
};
launchAppButton.Click += LaunchAppButton_Click;
-
Button terminateAppButton = new Button
{
Content = "Terminate",
Tag = remoteApplication
};
terminateAppButton.Click += TerminateAppButton_Click;
-
Button uninstallAppButton = new Button
{
Content = "Uninstall",
Tag = remoteApplication
};
uninstallAppButton.Click += UninstallAppButton_Click;
-
appIdLabel.SetValue(Grid.ColumnProperty, 0);
- appIdLabel.SetValue(Grid.RowProperty, _applicationRowIndex);
-
+ appIdLabel.SetValue(Grid.RowProperty, applicationRowIndex);
launchAppButton.SetValue(Grid.ColumnProperty, 1);
- launchAppButton.SetValue(Grid.RowProperty, _applicationRowIndex);
-
+ launchAppButton.SetValue(Grid.RowProperty, applicationRowIndex);
terminateAppButton.SetValue(Grid.ColumnProperty, 2);
- terminateAppButton.SetValue(Grid.RowProperty, _applicationRowIndex);
-
+ terminateAppButton.SetValue(Grid.RowProperty, applicationRowIndex);
uninstallAppButton.SetValue(Grid.ColumnProperty, 3);
- uninstallAppButton.SetValue(Grid.RowProperty, _applicationRowIndex);
-
- _deviceApplicationsGrid.Children.Add(appIdLabel);
- _deviceApplicationsGrid.Children.Add(launchAppButton);
- _deviceApplicationsGrid.Children.Add(terminateAppButton);
- _deviceApplicationsGrid.Children.Add(uninstallAppButton);
-
- _applicationRowIndex++;
+ uninstallAppButton.SetValue(Grid.RowProperty, applicationRowIndex);
+ deviceApplicationsGrid.Children.Add(appIdLabel);
+ deviceApplicationsGrid.Children.Add(launchAppButton);
+ deviceApplicationsGrid.Children.Add(terminateAppButton);
+ deviceApplicationsGrid.Children.Add(uninstallAppButton);
+ applicationRowIndex++;
}
+ ///
+ /// Terminate the corresponding application on a button click action.
+ ///
private void TerminateAppButton_Click(object sender, RoutedEventArgs e)
{
try
@@ -302,6 +291,9 @@ private void TerminateAppButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Uninstall the corresponding application on a button click action.
+ ///
private void UninstallAppButton_Click(object sender, RoutedEventArgs e)
{
try
@@ -315,6 +307,9 @@ private void UninstallAppButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Launch the corresponding application on a button click action.
+ ///
private void LaunchAppButton_Click(object sender, RoutedEventArgs e)
{
try
@@ -328,11 +323,10 @@ private void LaunchAppButton_Click(object sender, RoutedEventArgs e)
}
}
- private void ShowInfoDialog(String info)
- {
-
- }
-
+ ///
+ /// Show an error dialog for when an error occurs in the manager.
+ ///
+ /// Error to display.
private void ShowErrorDialog(String error)
{
BitmapImage errorImage = Misc.Image.GetResourceImage(AppStrings.APP_DIALOG_ERROR, Misc.Image.Extensions.png);
@@ -340,9 +334,13 @@ private void ShowErrorDialog(String error)
dialogPopup.Show();
}
+ ///
+ /// Get the root of this view for displaying purposes.
+ ///
+ /// Root of this view.
public StackPanel GetRoot()
{
- return _stackPanel;
+ return stackPanel;
}
}
}
diff --git a/WPAppInstall/WPAppInstall/Fragments/Settings.cs b/WPAppInstall/WPAppInstall/Fragments/Settings.cs
index 66a4878..6ff8fdf 100644
--- a/WPAppInstall/WPAppInstall/Fragments/Settings.cs
+++ b/WPAppInstall/WPAppInstall/Fragments/Settings.cs
@@ -12,19 +12,22 @@ namespace WPAppInstall.Fragments
///
/// This class builds the view / window to adjust the app settings.
///
-
public class Settings : IFragment
{
- private readonly StackPanel _rootPanel = new StackPanel();
- private readonly Label _startLabel = new Label();
- private readonly ComboBox _colorPreference = new ComboBox();
- private readonly IThemeUpdatable _themeUpdatable;
- private readonly IResizable _resizable;
+ private readonly StackPanel rootPanel = new StackPanel();
+ private readonly ComboBox colorPreference = new ComboBox();
+ private readonly IThemeUpdatable themeUpdatable;
+ private readonly IResizable resizable;
+ ///
+ /// Build the view or page that is used for changing the application settings.
+ ///
+ /// Callback for updating the application theme.
+ /// Callback for updating the application resize settings.
public Settings(IThemeUpdatable themeUpdatable, IResizable resizable)
{
- _themeUpdatable = themeUpdatable;
- _resizable = resizable;
+ this.themeUpdatable = themeUpdatable;
+ this.resizable = resizable;
Label colorLabel = new Label
{
@@ -32,17 +35,16 @@ public Settings(IThemeUpdatable themeUpdatable, IResizable resizable)
FontFamily = new System.Windows.Media.FontFamily(Misc.Application.Text.FONT)
};
-
foreach (Misc.Themes theme in (Misc.Themes[])Enum.GetValues(typeof(Misc.Themes)))
{
- _colorPreference.Items.Add(theme);
- _colorPreference.SelectionChanged += ColorPreference_SelectionChanged;
+ colorPreference.Items.Add(theme);
+ colorPreference.SelectionChanged += ColorPreference_SelectionChanged;
}
- _colorPreference.SelectedItem = Misc.Application.Lifecycle.ApplicationTheme;
+ colorPreference.SelectedItem = Misc.Application.Lifecycle.ApplicationTheme;
- _rootPanel.Children.Add(colorLabel);
- _rootPanel.Children.Add(_colorPreference);
+ rootPanel.Children.Add(colorLabel);
+ rootPanel.Children.Add(colorPreference);
Label resizableLabel = new Label
{
@@ -56,26 +58,36 @@ public Settings(IThemeUpdatable themeUpdatable, IResizable resizable)
};
resizableCheckbox.Click += ResizableCheckbox_Click;
- _rootPanel.Children.Add(resizableLabel);
- _rootPanel.Children.Add(resizableCheckbox);
+ rootPanel.Children.Add(resizableLabel);
+ rootPanel.Children.Add(resizableCheckbox);
}
+ ///
+ /// Change the application resize mode.
+ ///
private void ResizableCheckbox_Click(object sender, System.Windows.RoutedEventArgs e)
{
CheckBox checkBox = (CheckBox)sender;
- _resizable.SetResizable(checkBox.IsChecked.Value);
+ resizable.SetResizable(checkBox.IsChecked.Value);
}
+ ///
+ /// Update the application theme color.
+ ///
private void ColorPreference_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- Misc.Application.Lifecycle.ApplicationTheme = (Misc.Themes)_colorPreference.SelectedItem;
+ Misc.Application.Lifecycle.ApplicationTheme = (Misc.Themes)colorPreference.SelectedItem;
Misc.Application.Lifecycle.ApplicationColor = Misc.ColorTheme.GetThemeColor(Misc.Application.Lifecycle.ApplicationTheme);
- _themeUpdatable.UpdateAppTheme();
+ themeUpdatable.UpdateAppTheme();
}
+ ///
+ /// Get the root of this view for displaying purposes.
+ ///
+ /// Root of this view.
public StackPanel GetRoot()
{
- return _rootPanel;
+ return rootPanel;
}
}
}
diff --git a/WPAppInstall/WPAppInstall/Fragments/Start.cs b/WPAppInstall/WPAppInstall/Fragments/Start.cs
index 1c3700a..cf1681d 100644
--- a/WPAppInstall/WPAppInstall/Fragments/Start.cs
+++ b/WPAppInstall/WPAppInstall/Fragments/Start.cs
@@ -14,21 +14,21 @@ namespace WPAppInstall.Fragments
///
/// This class builds the view / window to launch apps from the virtual phone selection menu (start app page).
///
-
public class Start : IFragment
{
- private readonly StackPanel _rootPanel = new StackPanel();
- private readonly ScrollViewer _phoneScroller = new ScrollViewer();
- private readonly StackPanel _aboutPanel = new StackPanel();
- private readonly StackPanel _githubPanel = new StackPanel();
- private readonly StackPanel _linkedinPanel = new StackPanel();
- private readonly Grid _appGrid = new Grid();
- private readonly INavigator _navigator;
+ private readonly StackPanel rootPanel = new StackPanel();
+ private readonly ScrollViewer phoneScroller = new ScrollViewer();
+ private readonly StackPanel aboutPanel = new StackPanel();
+ private readonly Grid appGrid = new Grid();
+ private readonly INavigator navigator;
private readonly ButtonBoundary _buttonBackBoundary = new ButtonBoundary(new Point(41, 505), new Point(79, 541));
private readonly ButtonBoundary _buttonStartBoundary = new ButtonBoundary(new Point(155, 505), new Point(193, 541));
private readonly ButtonBoundary _buttonSearchBoundary = new ButtonBoundary(new Point(282, 505), new Point(312, 541));
+ ///
+ /// A button can have an x and y position in which an action is captured.
+ ///
internal class ButtonBoundary
{
public Point _x;
@@ -41,6 +41,9 @@ public ButtonBoundary(Point x, Point y)
}
}
+ ///
+ /// 'Applications' (or shortcuts) that are present by default in the app view.
+ ///
public enum Apps
{
About,
@@ -53,19 +56,23 @@ public enum Apps
Github
}
+ ///
+ /// Build the view or page that is used as a starting page.
+ ///
+ ///
public Start(INavigator navigator)
{
- _navigator = navigator;
+ this.navigator = navigator;
// Init Scroll panel
- _rootPanel.Orientation = Orientation.Vertical;
- _rootPanel.Width = 350;
- _rootPanel.Background = new ImageBrush(Misc.Image.GetPhoneImage(Misc.Application.Lifecycle.ApplicationTheme));
- _rootPanel.MouseLeftButtonDown += _rootPanel_MouseLeftButtonDown;
- _phoneScroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
- _phoneScroller.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
- _phoneScroller.Margin = new System.Windows.Thickness(20, 20, 20, 80);
- _rootPanel.Children.Add(_phoneScroller);
+ rootPanel.Orientation = Orientation.Vertical;
+ rootPanel.Width = 350;
+ rootPanel.Background = new ImageBrush(Misc.Image.GetPhoneImage(Misc.Application.Lifecycle.ApplicationTheme));
+ rootPanel.MouseLeftButtonDown += RootPanel_MouseLeftButtonDown;
+ phoneScroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
+ phoneScroller.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
+ phoneScroller.Margin = new System.Windows.Thickness(20, 20, 20, 80);
+ rootPanel.Children.Add(phoneScroller);
// Init About panel
Label aboutLabel = new Label
@@ -76,7 +83,7 @@ public Start(INavigator navigator)
Foreground = new SolidColorBrush(Misc.Application.Lifecycle.ApplicationColor)
};
- _aboutPanel.Children.Add(aboutLabel);
+ aboutPanel.Children.Add(aboutLabel);
TextBlock aboutHint = new TextBlock
{
@@ -86,7 +93,7 @@ public Start(INavigator navigator)
Margin = new System.Windows.Thickness(5, 0, 5, 0)
};
- _aboutPanel.Children.Add(aboutHint);
+ aboutPanel.Children.Add(aboutHint);
TextBlock githubHint = new TextBlock
{
@@ -96,7 +103,7 @@ public Start(INavigator navigator)
TextWrapping = System.Windows.TextWrapping.Wrap
};
- _aboutPanel.Children.Add(githubHint);
+ aboutPanel.Children.Add(githubHint);
Button githubButton = new Button
{
@@ -110,47 +117,57 @@ public Start(INavigator navigator)
};
githubButton.Click += GithubButton_Click;
- _aboutPanel.Children.Add(githubButton);
+ aboutPanel.Children.Add(githubButton);
// Start panel
- _appGrid = new Grid();
- _appGrid.RowDefinitions.Add(new RowDefinition());
- _appGrid.RowDefinitions.Add(new RowDefinition());
- _appGrid.RowDefinitions.Add(new RowDefinition());
- _appGrid.RowDefinitions.Add(new RowDefinition());
- _appGrid.ColumnDefinitions.Add(new ColumnDefinition());
- _appGrid.ColumnDefinitions.Add(new ColumnDefinition());
-
- _phoneScroller.Content = _appGrid;
-
- _appGrid.Margin = new System.Windows.Thickness(20, 20, 20, 0);
- AddApp(_appGrid, Apps.About, 0, 0);
- AddApp(_appGrid, Apps.Devices, 1, 0);
- AddApp(_appGrid, Apps.Apps, 0, 1);
- AddApp(_appGrid, Apps.Deploy, 1, 1);
- AddApp(_appGrid, Apps.Manager, 0, 2);
- AddApp(_appGrid, Apps.Settings, 1, 2);
- AddApp(_appGrid, Apps.Github, 0, 3);
- AddApp(_appGrid, Apps.LinkedIn, 1, 3);
-
- _phoneScroller.Content = _appGrid;
+ appGrid = new Grid();
+ appGrid.RowDefinitions.Add(new RowDefinition());
+ appGrid.RowDefinitions.Add(new RowDefinition());
+ appGrid.RowDefinitions.Add(new RowDefinition());
+ appGrid.RowDefinitions.Add(new RowDefinition());
+ appGrid.ColumnDefinitions.Add(new ColumnDefinition());
+ appGrid.ColumnDefinitions.Add(new ColumnDefinition());
+
+ phoneScroller.Content = appGrid;
+
+ appGrid.Margin = new System.Windows.Thickness(20, 20, 20, 0);
+ AddApp(appGrid, Apps.About, 0, 0);
+ AddApp(appGrid, Apps.Devices, 1, 0);
+ AddApp(appGrid, Apps.Apps, 0, 1);
+ AddApp(appGrid, Apps.Deploy, 1, 1);
+ AddApp(appGrid, Apps.Manager, 0, 2);
+ AddApp(appGrid, Apps.Settings, 1, 2);
+ AddApp(appGrid, Apps.Github, 0, 3);
+ AddApp(appGrid, Apps.LinkedIn, 1, 3);
+
+ phoneScroller.Content = appGrid;
}
- private void _rootPanel_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+ ///
+ /// Check whether a device button was clicked by verifying the known boundaries.
+ ///
+ private void RootPanel_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
Point mousePosition = e.GetPosition((StackPanel)sender);
double x = mousePosition.X;
double y = mousePosition.Y;
if (x > _buttonBackBoundary._x.X && x < _buttonBackBoundary._y.X && y > _buttonBackBoundary._x.Y && y < _buttonBackBoundary._y.Y)
- _phoneScroller.Content = _appGrid;
+ phoneScroller.Content = appGrid;
if (x > _buttonStartBoundary._x.X && x < _buttonStartBoundary._y.X && y > _buttonStartBoundary._x.Y && y < _buttonStartBoundary._y.Y)
- _phoneScroller.Content = _appGrid;
+ phoneScroller.Content = appGrid;
if (x > _buttonSearchBoundary._x.X && x < _buttonSearchBoundary._y.X && y > _buttonSearchBoundary._x.Y && y < _buttonSearchBoundary._y.Y)
- _phoneScroller.Content = _appGrid;
+ phoneScroller.Content = appGrid;
}
+ ///
+ /// Add an application to the grid.
+ ///
+ /// Grid to add app to.
+ /// App to add to grid.
+ /// App column.
+ /// App row.
private void AddApp(Grid appGrid, Apps app, int column, int row)
{
StackPanel buttonStack = new StackPanel
@@ -188,28 +205,31 @@ private void AddApp(Grid appGrid, Apps app, int column, int row)
appGrid.Children.Add(buttonStack);
}
+ ///
+ /// Verify which app was pressed and perform an action.
+ ///
private void ButtonStack_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
StackPanel stackPanel = (StackPanel)sender;
switch (stackPanel.Name)
{
case nameof(Apps.About):
- _phoneScroller.Content = _aboutPanel;
+ phoneScroller.Content = aboutPanel;
break;
case nameof(Apps.Devices):
- _navigator.Navigate(Misc.AppPages.Devices);
+ navigator.Navigate(Misc.AppPages.Devices);
break;
case nameof(Apps.Apps):
- _navigator.Navigate(Misc.AppPages.Apps);
+ navigator.Navigate(Misc.AppPages.Apps);
break;
case nameof(Apps.Deploy):
- _navigator.Navigate(Misc.AppPages.Deploy);
+ navigator.Navigate(Misc.AppPages.Deploy);
break;
case nameof(Apps.Manager):
- _navigator.Navigate(Misc.AppPages.Manager);
+ navigator.Navigate(Misc.AppPages.Manager);
break;
case nameof(Apps.Settings):
- _navigator.Navigate(Misc.AppPages.Settings);
+ navigator.Navigate(Misc.AppPages.Settings);
break;
case nameof(Apps.LinkedIn):
System.Diagnostics.Process.Start(Resources.Strings.AppStrings.APP_URL_LINKEDIN);
@@ -220,14 +240,21 @@ private void ButtonStack_MouseLeftButtonDown(object sender, System.Windows.Input
}
}
+ ///
+ /// This action is used for the separate link as displayed under the dedicated about section.
+ ///
private void GithubButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
System.Diagnostics.Process.Start(Resources.Strings.AppStrings.APP_URL_GITHUB);
}
+ ///
+ /// Get the root of this view for displaying purposes.
+ ///
+ /// Root of this view.
public StackPanel GetRoot()
{
- return _rootPanel;
+ return rootPanel;
}
}
diff --git a/WPAppInstall/WPAppInstall/Interfaces/IFragment.cs b/WPAppInstall/WPAppInstall/Interfaces/IFragment.cs
index cb6c9f6..55f7944 100644
--- a/WPAppInstall/WPAppInstall/Interfaces/IFragment.cs
+++ b/WPAppInstall/WPAppInstall/Interfaces/IFragment.cs
@@ -10,7 +10,6 @@ namespace WPAppInstall.Interfaces
///
/// Interface for fragments.
///
-
interface IFragment
{
StackPanel GetRoot();
diff --git a/WPAppInstall/WPAppInstall/Interfaces/INavigator.cs b/WPAppInstall/WPAppInstall/Interfaces/INavigator.cs
index cce9830..59e88ac 100644
--- a/WPAppInstall/WPAppInstall/Interfaces/INavigator.cs
+++ b/WPAppInstall/WPAppInstall/Interfaces/INavigator.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.Interfaces
///
/// Interface to navigate to a different application page.
///
-
public interface INavigator
{
void Navigate(Misc.AppPages appPage);
diff --git a/WPAppInstall/WPAppInstall/Interfaces/IResizable.cs b/WPAppInstall/WPAppInstall/Interfaces/IResizable.cs
index af22a90..89fc492 100644
--- a/WPAppInstall/WPAppInstall/Interfaces/IResizable.cs
+++ b/WPAppInstall/WPAppInstall/Interfaces/IResizable.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.Interfaces
///
/// Interface to resize an application window.
///
-
public interface IResizable
{
void SetResizable(bool enabled);
diff --git a/WPAppInstall/WPAppInstall/Interfaces/IThemeUpdatable.cs b/WPAppInstall/WPAppInstall/Interfaces/IThemeUpdatable.cs
index 01879f5..0b26881 100644
--- a/WPAppInstall/WPAppInstall/Interfaces/IThemeUpdatable.cs
+++ b/WPAppInstall/WPAppInstall/Interfaces/IThemeUpdatable.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.Interfaces
///
/// Interface to update the application theme.
///
-
public interface IThemeUpdatable
{
void UpdateAppTheme();
diff --git a/WPAppInstall/WPAppInstall/MainWindow.xaml b/WPAppInstall/WPAppInstall/MainWindow.xaml
index 7ee474d..119a4f6 100644
--- a/WPAppInstall/WPAppInstall/MainWindow.xaml
+++ b/WPAppInstall/WPAppInstall/MainWindow.xaml
@@ -3,7 +3,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:local="clr-namespace:WPAppInstall"
mc:Ignorable="d"
ResizeMode="NoResize"
Height="700" Width="800">
diff --git a/WPAppInstall/WPAppInstall/MainWindow.xaml.cs b/WPAppInstall/WPAppInstall/MainWindow.xaml.cs
index 80465d6..76be8f6 100644
--- a/WPAppInstall/WPAppInstall/MainWindow.xaml.cs
+++ b/WPAppInstall/WPAppInstall/MainWindow.xaml.cs
@@ -25,16 +25,16 @@ namespace WPAppInstall
///
/// Main application window.
///
-
public partial class MainWindow : Window, IThemeUpdatable, IUSBSubsriber, INavigator, IResizable
{
-
- private USBConnectionHandler _windowsPhoneHandlerUSB;
+ private USBConnectionHandler windowsPhoneHandlerUSB;
private DialogPopup _dialogUSB;
+ ///
+ /// Build the user interface and bind button actions.
+ ///
public MainWindow()
{
-
InitializeComponent();
Title = AppStrings.APP_NAME;
AppDescription.Content = AppStrings.APP_DESCRIPTION;
@@ -71,10 +71,12 @@ public MainWindow()
this.UseLayoutRounding = true;
SelectPage(Misc.Application.Lifecycle.ApplicationPage);
- _windowsPhoneHandlerUSB = new USBConnectionHandler(this);
-
+ windowsPhoneHandlerUSB = new USBConnectionHandler(this);
}
+ ///
+ /// Select and open the manager page.
+ ///
private void ManagerMenuButton_Click(object sender, RoutedEventArgs e)
{
if (Misc.Application.Lifecycle.ApplicationPage != AppPages.Manager)
@@ -84,6 +86,9 @@ private void ManagerMenuButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Select and open the apps page.
+ ///
private void AppsButton_Click(object sender, RoutedEventArgs e)
{
if (Misc.Application.Lifecycle.ApplicationPage != AppPages.Apps)
@@ -93,6 +98,9 @@ private void AppsButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Select and open the start page.
+ ///
private void StartButton_Click(object sender, RoutedEventArgs e)
{
if (Misc.Application.Lifecycle.ApplicationPage != AppPages.Start)
@@ -102,6 +110,9 @@ private void StartButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Navigate to the previously visited page.
+ ///
private void PreviousMenuButton_Click(object sender, RoutedEventArgs e)
{
AppPages? appPage = Misc.Application.Lifecycle.PopPage();
@@ -117,11 +128,17 @@ private void PreviousMenuButton_Click(object sender, RoutedEventArgs e)
PreviousMenuButton.IsEnabled = false;
}
+ ///
+ /// Exit the application.
+ ///
private void ExitMenuButton_Click(object sender, RoutedEventArgs e)
{
System.Windows.Application.Current.Shutdown();
}
+ ///
+ /// Navigate to the settings page.
+ ///
private void SettingsButton_Click(object sender, RoutedEventArgs e)
{
@@ -132,6 +149,9 @@ private void SettingsButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Navigate to the deploy page.
+ ///
private void DeployButton_Click(object sender, RoutedEventArgs e)
{
if (Misc.Application.Lifecycle.ApplicationPage != AppPages.Deploy)
@@ -141,6 +161,9 @@ private void DeployButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Navigate to the devices page.
+ ///
private void DevicesButton_Click(object sender, RoutedEventArgs e)
{
if (Misc.Application.Lifecycle.ApplicationPage != AppPages.Devices)
@@ -150,6 +173,10 @@ private void DevicesButton_Click(object sender, RoutedEventArgs e)
}
}
+ ///
+ /// Navigate to the selected page.
+ ///
+ /// Page to navigate to.
private void SelectPage(AppPages page)
{
switch (page)
@@ -186,7 +213,12 @@ private void SelectPage(AppPages page)
Misc.Application.Lifecycle.ApplicationPage = page;
}
- private void DeselectPage(AppPages page, bool isPreviousPage = false)
+ ///
+ /// Move away from a page.
+ ///
+ /// Move away from the specified page.
+ /// Describe whether the page should be added to previous pages.
+ private void DeselectPage(AppPages page, Boolean isPreviousPage = false)
{
switch (page)
{
@@ -214,6 +246,9 @@ private void DeselectPage(AppPages page, bool isPreviousPage = false)
}
}
+ ///
+ /// Update the application theme color.
+ ///
public void UpdateAppTheme()
{
AppDescription.Foreground = new SolidColorBrush(Misc.Application.Lifecycle.ApplicationColor);
@@ -221,23 +256,29 @@ public void UpdateAppTheme()
WPSeperatorImage.Source = Misc.Image.GetSeperator(Misc.Application.Lifecycle.ApplicationTheme);
}
+ ///
+ /// Create a popup that displays information about a connected or disconnected usb device.
+ ///
+ /// Usb connect or disconnect action.
+ /// Name of the connected or disconnected device.
private void USBPopup(USBConnectionHandler.USBActions action, String name)
{
- Thread.Sleep(500); // Time needed to add more potential devices after this request (see USBConnectionHandler).
+ // Time needed to add more potential devices after this request (see USBConnectionHandler).
+ Thread.Sleep(500);
USBConnectionHandler.USBDevice usbProperty = new USBConnectionHandler.USBDevice(name);
- VendorIds.Vendors? vendor = VendorIds.GetVendor(usbProperty.vendorId);
+ VendorIds.Vendors? vendor = VendorIds.GetVendor(usbProperty.VendorId);
if (vendor == null) return;
- String vid = $"{AppStrings.HARDWARE_USB_VID}: {usbProperty.vendorId} ({((VendorIds.Vendors)vendor).ToString()})";
- String pid = $"{AppStrings.HARDWARE_USB_PID}: {usbProperty.productId}";
- String guid = $"{AppStrings.HARDWARE_USB_GUID}: {usbProperty.guid}";
+ String vid = $"{AppStrings.HARDWARE_USB_VID}: {usbProperty.VendorId} ({((VendorIds.Vendors)vendor).ToString()})";
+ String pid = $"{AppStrings.HARDWARE_USB_PID}: {usbProperty.ProductId}";
+ String guid = $"{AppStrings.HARDWARE_USB_GUID}: {usbProperty.Guid}";
- String pidAddition = ProductIds.GetPIDAddition(usbProperty.productId);
+ String pidAddition = ProductIds.GetPIDAddition(usbProperty.ProductId);
if (pidAddition != null)
- pid += $" ({ProductIds.GetPIDAddition(usbProperty.productId)})";
- else if (usbProperty.productId != AppStrings.APP_WINDOWS_PHONE_7_PID)
+ pid += $" ({ProductIds.GetPIDAddition(usbProperty.ProductId)})";
+ else if (usbProperty.ProductId != AppStrings.APP_WINDOWS_PHONE_7_PID)
pid += $" ({AppStrings.APP_WINDOWS_PHONE_8_10_DEVICE})";
String content = String.Empty;
@@ -245,21 +286,21 @@ private void USBPopup(USBConnectionHandler.USBActions action, String name)
USBScanner.USBDevice usbDevice = null;
if (action == USBConnectionHandler.USBActions.Connect)
- Misc.Application.Lifecycle.DevicesUSB = USBScanner.GetUSBDevices(USBScanner.FILTER_PROPERTIES_WINDOWS_PHONE);
+ Misc.Application.Lifecycle.DevicesUSB = USBScanner.GetUSBDevices(USBScanner.FilterPropertiesWindowsPhone);
Misc.Application.Lifecycle.DevicesUSB.ForEach(device =>
{
- USBConnectionHandler.USBDevice usbDeviceProperty = new USBConnectionHandler.USBDevice(device.pnpDeviceId);
+ USBConnectionHandler.USBDevice usbDeviceProperty = new USBConnectionHandler.USBDevice(device.PnpDeviceId);
- if (usbDeviceProperty.productId == usbProperty.productId && usbDeviceProperty.vendorId == usbProperty.vendorId) // && usbDeviceProperty.vendorId == usbProperty.vendorId
+ if (usbDeviceProperty.ProductId == usbProperty.ProductId && usbDeviceProperty.VendorId == usbProperty.VendorId) // && usbDeviceProperty.vendorId == usbProperty.vendorId
{
usbDevice = device;
- VendorIds.Vendors? vendorContains = VendorIds.Contains(device.name);
+ VendorIds.Vendors? vendorContains = VendorIds.Contains(device.Name);
if (vendorContains != null)
vendor = vendorContains;
- if (ProductIds.Contains(device.name))
+ if (ProductIds.Contains(device.Name))
return;
}
});
@@ -268,8 +309,8 @@ private void USBPopup(USBConnectionHandler.USBActions action, String name)
if (usbDevice != null)
{
- content += $"\n{AppStrings.HARDWARE_USB_CAPTION}: {usbDevice.caption.ToUpper()}\n\n{AppStrings.HARDWARE_USB_MANUFACTURER}: {usbDevice.manufacturer}\n{AppStrings.HARDWARE_USB_DESCRIPTION}: {usbDevice.description}\n{AppStrings.HARDWARE_USB_STATUS}: {usbDevice.status}\n\n";
- deviceImage = Misc.Image.GetDeviceImage(usbDevice.pnpDeviceId);
+ content += $"\n{AppStrings.HARDWARE_USB_CAPTION}: {usbDevice.Caption.ToUpper()}\n\n{AppStrings.HARDWARE_USB_MANUFACTURER}: {usbDevice.Manufacturer}\n{AppStrings.HARDWARE_USB_DESCRIPTION}: {usbDevice.Description}\n{AppStrings.HARDWARE_USB_STATUS}: {usbDevice.Status}\n\n";
+ deviceImage = Misc.Image.GetDeviceImage(usbDevice.PnpDeviceId);
}
@@ -288,23 +329,39 @@ private void USBPopup(USBConnectionHandler.USBActions action, String name)
}));
}
+ ///
+ /// Create a popup for a connected device.
+ ///
+ /// Name of the connected device.
public void NotifyConnected(String name)
{
USBPopup(USBConnectionHandler.USBActions.Connect, name);
}
+ ///
+ /// Create a popup for a disconnected device.
+ ///
+ /// Name of the disconnected device.
public void NotifyDisconnected(String name)
{
USBPopup(USBConnectionHandler.USBActions.Disconnect, name);
}
+ ///
+ /// Navigate to a page.
+ ///
+ /// Page to navigate to.
public void Navigate(AppPages appPage)
{
DeselectPage(Misc.Application.Lifecycle.ApplicationPage);
SelectPage(appPage);
}
- public void SetResizable(bool enabled)
+ ///
+ /// Enable or disable resizing the application.
+ ///
+ /// Enable (true) or disable (false) resizing the application.
+ public void SetResizable(Boolean enabled)
{
this.ResizeMode = enabled ? ResizeMode.CanResizeWithGrip : ResizeMode.NoResize;
}
diff --git a/WPAppInstall/WPAppInstall/Misc/AppPages.cs b/WPAppInstall/WPAppInstall/Misc/AppPages.cs
index 55aeb5f..c46bdc3 100644
--- a/WPAppInstall/WPAppInstall/Misc/AppPages.cs
+++ b/WPAppInstall/WPAppInstall/Misc/AppPages.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.Misc
///
/// This enum lists the different pages implemented in the application.
///
-
public enum AppPages
{
Start,
diff --git a/WPAppInstall/WPAppInstall/Misc/Application.cs b/WPAppInstall/WPAppInstall/Misc/Application.cs
index d4c8044..d250e3b 100644
--- a/WPAppInstall/WPAppInstall/Misc/Application.cs
+++ b/WPAppInstall/WPAppInstall/Misc/Application.cs
@@ -13,7 +13,6 @@ namespace WPAppInstall.Misc
///
/// This class provides a few default settings and a Lifecycle class which contains instances of objects for easy access.
///
-
public static class Application
{
public static class Margin
@@ -32,38 +31,53 @@ public static class Generic
public static readonly int MAX_PAGE_HISTORY = 9;
}
+ ///
+ /// Class that stores data relevant to the application in a lifecycle object.
+ ///
public static class Lifecycle
{
public static Themes ApplicationTheme = Themes.Blackberry;
public static Color ApplicationColor = ColorTheme.GetThemeColor(ApplicationTheme);
public static AppPages ApplicationPage = AppPages.Start;
- private static List _applicationPageHistory = new List();
+ private static List applicationPageHistory = new List();
public static Hardware81 Hardware81 = new Hardware81();
- public static List DevicesUSB = USBScanner.GetUSBDevices(USBScanner.FILTER_PROPERTIES_WINDOWS_PHONE);
- public static String[] paths = new String[0];
- public static Microsoft.Phone.Tools.Deploy.IAppManifestInfo[] manifestInfoList = new Microsoft.Phone.Tools.Deploy.IAppManifestInfo[0];
+ public static List DevicesUSB = USBScanner.GetUSBDevices(USBScanner.FilterPropertiesWindowsPhone);
+ public static String[] Paths = new String[0];
+ public static Microsoft.Phone.Tools.Deploy.IAppManifestInfo[] ManifestInfoList = new Microsoft.Phone.Tools.Deploy.IAppManifestInfo[0];
- public static bool HistoryContainsMorePages()
+ ///
+ /// Check whether the page history is empty or not.
+ ///
+ ///
+ public static Boolean HistoryContainsMorePages()
{
- return _applicationPageHistory.Count > 0;
+ return applicationPageHistory.Count > 0;
}
+ ///
+ /// Navigate to the previously visited page.
+ ///
+ /// Previously visited page.
public static AppPages? PopPage()
{
- if (_applicationPageHistory.Count>0)
+ if (applicationPageHistory.Count>0)
{
- AppPages appPage = _applicationPageHistory[_applicationPageHistory.Count - 1];
- _applicationPageHistory.Remove(appPage);
+ AppPages appPage = applicationPageHistory[applicationPageHistory.Count - 1];
+ applicationPageHistory.Remove(appPage);
return appPage;
}
return null;
}
+ ///
+ /// Add a page to the navigation history.
+ ///
+ /// Last visited page.
public static void AddPage(AppPages page)
{
- _applicationPageHistory.Add(page);
- if (_applicationPageHistory.Count >= Generic.MAX_PAGE_HISTORY)
- _applicationPageHistory.RemoveAt(0);
+ applicationPageHistory.Add(page);
+ if (applicationPageHistory.Count >= Generic.MAX_PAGE_HISTORY)
+ applicationPageHistory.RemoveAt(0);
}
}
}
diff --git a/WPAppInstall/WPAppInstall/Misc/ColorTheme.cs b/WPAppInstall/WPAppInstall/Misc/ColorTheme.cs
index 751c38d..9925e6f 100644
--- a/WPAppInstall/WPAppInstall/Misc/ColorTheme.cs
+++ b/WPAppInstall/WPAppInstall/Misc/ColorTheme.cs
@@ -10,33 +10,37 @@ namespace WPAppInstall.Misc
///
/// This class lists different color themes included in the application.
///
-
public static class ColorTheme
{
- private static readonly Color Apple = Color.FromRgb(228, 13, 0);
- private static readonly Color Banana = Color.FromRgb(228, 210, 0);
- private static readonly Color Blackberry = Color.FromRgb(75, 75, 75);
- private static readonly Color Blueberry = Color.FromRgb(0, 49, 228);
- private static readonly Color Raspberry = Color.FromRgb(228, 0, 147);
- private static readonly Color Lime = Color.FromRgb(19, 228, 0);
- private static readonly Color Mango = Color.FromRgb(228, 138, 0);
- private static readonly Color Plum = Color.FromRgb(149, 0, 228);
- private static readonly Color Coconut = Color.FromRgb(0, 0, 0);
+ private static readonly Color apple = Color.FromRgb(228, 13, 0);
+ private static readonly Color banana = Color.FromRgb(228, 210, 0);
+ private static readonly Color blackberry = Color.FromRgb(75, 75, 75);
+ private static readonly Color blueberry = Color.FromRgb(0, 49, 228);
+ private static readonly Color raspberry = Color.FromRgb(228, 0, 147);
+ private static readonly Color lime = Color.FromRgb(19, 228, 0);
+ private static readonly Color mango = Color.FromRgb(228, 138, 0);
+ private static readonly Color plum = Color.FromRgb(149, 0, 228);
+ private static readonly Color coconut = Color.FromRgb(0, 0, 0);
+ ///
+ /// Get the application theme as a color.
+ ///
+ /// Selected application theme.
+ /// Color corresponding with the theme parsed as argument.
public static Color GetThemeColor(Themes theme)
{
switch (theme)
{
- case Themes.Apple: return Apple;
- case Themes.Banana: return Banana;
- case Themes.Blackberry: return Blackberry;
- case Themes.Blueberry: return Blueberry;
- case Themes.Raspberry: return Raspberry;
- case Themes.Lime: return Lime;
- case Themes.Mango: return Mango;
- case Themes.Plum: return Plum;
- case Themes.Coconut: return Coconut;
- default: return Blackberry;
+ case Themes.Apple: return apple;
+ case Themes.Banana: return banana;
+ case Themes.Blackberry: return blackberry;
+ case Themes.Blueberry: return blueberry;
+ case Themes.Raspberry: return raspberry;
+ case Themes.Lime: return lime;
+ case Themes.Mango: return mango;
+ case Themes.Plum: return plum;
+ case Themes.Coconut: return coconut;
+ default: return blackberry;
}
}
}
diff --git a/WPAppInstall/WPAppInstall/Misc/Image.cs b/WPAppInstall/WPAppInstall/Misc/Image.cs
index f6d9c0b..8fee263 100644
--- a/WPAppInstall/WPAppInstall/Misc/Image.cs
+++ b/WPAppInstall/WPAppInstall/Misc/Image.cs
@@ -20,6 +20,9 @@ namespace WPAppInstall.Misc
public static class Image
{
+ ///
+ /// Supported image extensions.
+ ///
public enum Extensions
{
png,
@@ -27,53 +30,99 @@ public enum Extensions
jpeg
}
+ ///
+ /// Get a uri for the desired image.
+ ///
+ /// Name of the image.
+ /// Extension of the image.
+ ///
private static Uri GetImageUri(String imageName, String extension)
{
return new Uri($"{Resources.Strings.AppStrings.APP_PACK_RESOURCES_IMAGES}{imageName}.{extension}", UriKind.RelativeOrAbsolute);
}
+ ///
+ /// Get an image by a uri.
+ ///
+ /// Image uri.
+ /// Image as BitmapImage.
private static BitmapImage GetImageByUri(Uri uri)
{
return new BitmapImage(uri);
}
+ ///
+ /// Get the image for a device.
+ ///
+ /// Device string for retrieving the image.
+ /// Device BitmapImage.
public static BitmapFrame GetDeviceImage(String portableDeviceString)
{
String iconPath = $@"{Resources.Strings.AppStrings.DEVICE_WPD_ICON_LOCATION}\{portableDeviceString.Replace('\\', '#')}.ico";
- if (!File.Exists(iconPath)) return null; // return default Image.
+ if (!File.Exists(iconPath)) return null;
BitmapDecoder decoder = BitmapDecoder.Create(new Uri(iconPath), BitmapCreateOptions.DelayCreation, BitmapCacheOption.OnDemand);
BitmapFrame result = decoder.Frames.SingleOrDefault(f => f.Width == 256);
return result;
}
-
+ ///
+ /// Get a resource as BitmapImage.
+ ///
+ /// Name of the image.
+ /// Extension of the image.
+ ///
public static BitmapImage GetResourceImage(String imageName, Extensions extension)
{
return GetImageByUri(GetImageUri(imageName.ToString(), extension.ToString()));
}
+ ///
+ /// Get the brand as a BitmapImage.
+ ///
+ /// Vendor of the device.
+ /// Logo of the brand as BitmapImage.
public static BitmapImage GetBrandLogo(VendorIds.Vendors vendor)
{
return GetImageByUri(GetImageUri(Resources.Strings.AppStrings.APP_BRAND_LOGO + vendor.ToString(), Extensions.png.ToString()));
}
+ ///
+ /// Get an image for a default application (or shortcut) on the start screen.
+ ///
+ /// App to retrieve the image for.
+ /// BitmapImage for the app.
public static BitmapImage GetAppImage(Start.Apps app)
{
return GetImageByUri(GetImageUri(Resources.Strings.AppStrings.APP_APP_LOGO + app.ToString(), Extensions.png.ToString()));
}
+ ///
+ /// Get an image for the displayed phone on the start screen depending on the selected theme color.
+ ///
+ /// Selected application theme color.
+ /// Start screen phone BitmapImage for the selected theme.
public static BitmapImage GetPhoneImage(Themes theme)
{
return GetImageByUri(GetImageUri(Resources.Strings.AppStrings.APP_PHONE + theme.ToString(), Extensions.png.ToString()));
}
+ ///
+ /// Get a logo image / icon for the application depending on the selected theme color.
+ ///
+ /// Selected application theme color.
+ /// Start screen logo BitmapImage for the selected theme.
public static BitmapImage GetIcon(Themes theme)
{
return GetImageByUri(GetImageUri(Resources.Strings.AppStrings.APP_ICON + theme.ToString(), Extensions.png.ToString()));
}
+ ///
+ /// Get a seperator (vertical colored line) depending on the selected theme color.
+ ///
+ /// Selected application theme color.
+ /// Start screen separator BitmapImage for the selected theme.
public static BitmapImage GetSeperator(Themes theme)
{
return GetImageByUri(GetImageUri(Resources.Strings.AppStrings.APP_SEPERATOR + theme.ToString(), Extensions.png.ToString()));
diff --git a/WPAppInstall/WPAppInstall/Misc/Themes.cs b/WPAppInstall/WPAppInstall/Misc/Themes.cs
index c6f0066..b06bfdf 100644
--- a/WPAppInstall/WPAppInstall/Misc/Themes.cs
+++ b/WPAppInstall/WPAppInstall/Misc/Themes.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.Misc
///
/// This enum lists a few default application themes which can be selected and adjust the apps color to the color of a fruit.
///
-
public enum Themes
{
Apple,
diff --git a/WPAppInstall/WPAppInstall/Properties/Resources.Designer.cs b/WPAppInstall/WPAppInstall/Properties/Resources.Designer.cs
index 59eb4fa..3fd6316 100644
--- a/WPAppInstall/WPAppInstall/Properties/Resources.Designer.cs
+++ b/WPAppInstall/WPAppInstall/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace WPAppInstall.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -59,5 +59,15 @@ internal Resources() {
resourceCulture = value;
}
}
+
+ ///
+ /// Looks up a localized resource of type System.Byte[].
+ ///
+ internal static byte[] PhoneRegDll {
+ get {
+ object obj = ResourceManager.GetObject("PhoneRegDll", resourceCulture);
+ return ((byte[])(obj));
+ }
+ }
}
}
diff --git a/WPAppInstall/WPAppInstall/Properties/Resources.resx b/WPAppInstall/WPAppInstall/Properties/Resources.resx
index af7dbeb..6944bb7 100644
--- a/WPAppInstall/WPAppInstall/Properties/Resources.resx
+++ b/WPAppInstall/WPAppInstall/Properties/Resources.resx
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
- : System.Serialization.Formatters.Binary.BinaryFormatter
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
+
@@ -68,9 +69,10 @@
-
+
+
@@ -85,9 +87,10 @@
-
+
+
@@ -109,9 +112,13 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\phoneregdll.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/WPAppInstall/WPAppInstall/Properties/Settings.Designer.cs b/WPAppInstall/WPAppInstall/Properties/Settings.Designer.cs
index 928264a..af7539f 100644
--- a/WPAppInstall/WPAppInstall/Properties/Settings.Designer.cs
+++ b/WPAppInstall/WPAppInstall/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace WPAppInstall.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
diff --git a/WPAppInstall/WPAppInstall/WPAppInstall.csproj b/WPAppInstall/WPAppInstall/WPAppInstall.csproj
index ba491ca..92a33ba 100644
--- a/WPAppInstall/WPAppInstall/WPAppInstall.csproj
+++ b/WPAppInstall/WPAppInstall/WPAppInstall.csproj
@@ -8,12 +8,27 @@
WinExe
WPAppInstall
WPAppInstall
- v4.7.2
+ v4.8
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
true
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
AnyCPU
@@ -24,6 +39,7 @@
DEBUG;TRACE
prompt
4
+ true
AnyCPU
@@ -77,33 +93,42 @@
MinimumRecommendedRules.ruleset
true
+
+ WPAppInstall.App
+
False
..\Dependencies\Microsoft.Phone.Tools.Common.dll
False
+ False
False
..\Dependencies\Microsoft.Phone.Tools.Deploy.dll
+ False
..\Dependencies\Microsoft.SmartDevice.Connectivity.dll
+ False
False
..\Dependencies\Microsoft.Smartdevice.Connectivity.Interface.dll
False
+ False
False
..\Dependencies\Microsoft.Smartdevice.ConnectivityWrapper.12.dll
False
+ False
False
..\Dependencies\Microsoft.Smartdevice.MultiTargeting.Connectivity.dll
False
+ False
@@ -122,10 +147,10 @@
-
+
MSBuild:Compile
Designer
-
+
DialogPopup.xaml
@@ -139,6 +164,7 @@
+
@@ -282,5 +308,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4.8 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
\ No newline at end of file
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneStates.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneStates.cs
index 960753b..1b9ef1c 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneStates.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneStates.cs
@@ -7,9 +7,8 @@
namespace WPAppInstall.WindowsPhone.Common
{
///
- /// This class lists the state of the phone.
+ /// This class lists the possible states of the phone.
///
-
public enum PhoneStates
{
Registered,
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneType.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneType.cs
index ddd0651..42b79e3 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneType.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneType.cs
@@ -10,9 +10,11 @@ namespace WPAppInstall.WindowsPhone.Common
///
/// This class contains a few functions to verify what kind of device is connected.
///
-
public class PhoneType
{
+ ///
+ /// The following result codes are possible when connecting a device.
+ ///
public enum ErrorResults
{
NoError,
@@ -20,24 +22,28 @@ public enum ErrorResults
ConfigError
}
- public int _portMapped;
- public ErrorResults _errorResult;
+ public Int32 portMapped;
+ public ErrorResults errorResult;
+ ///
+ /// Get the type of the phone connected.
+ ///
+ /// Type of the phone connected.
public PhoneTypes? GetPhoneType()
{
- _errorResult = ErrorResults.NoError;
- uint windowsPhone8Port = NativeMethods.GetWinPhone8Port(Utils.Constants.PHONE_PORT, out _portMapped);
+ errorResult = ErrorResults.NoError;
+ uint windowsPhone8Port = NativeMethods.GetWinPhone8Port(Utils.Constants.WindowsPhonePort, out portMapped);
if (windowsPhone8Port!=0U)
{
switch(windowsPhone8Port)
{
case 2306021393U:
// Multiple Devices Connected
- _errorResult = ErrorResults.MultipleDevices;
+ errorResult = ErrorResults.MultipleDevices;
return null;
case 2306021394U:
// Windows Phone 8 Config Error
- _errorResult = ErrorResults.ConfigError;
+ errorResult = ErrorResults.ConfigError;
return null;
}
}
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneTypes.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneTypes.cs
index 04c3c32..cbdb918 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneTypes.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Common/PhoneTypes.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.WindowsPhone.Common
///
/// This enum lists the kind of device in terms of functionality. WindowsPhone7 should be handed differently than WindowsPhone8or10.
///
-
public enum PhoneTypes
{
WindowsPhone7,
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/DeviceController.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/DeviceController.cs
index 9fa64a6..b7128b3 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/DeviceController.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/DeviceController.cs
@@ -16,47 +16,58 @@ namespace WPAppInstall.WindowsPhone.Hardware
///
/// This class allows to perform actions on Win32 devices.
///
-
public class DeviceController
{
- private const String CMD = "cmd.exe";
- private const String ENABLE_DEVICE_COMMAND = "enable-device";
- private const String DISABLE_DEVICE_COMMAND = "disable-device";
+ private const String cmdProcess = "cmd.exe";
+ private const String enableDeviceCommand = "enable-device";
+ private const String disableDeviceCommand = "disable-device";
+ ///
+ /// Function to disable file system redirection.
+ ///
[DllImport("kernel32.dll", SetLastError = true)]
- public static extern int Wow64DisableWow64FsRedirection(ref IntPtr ptr);
+ public static extern Int32 Wow64DisableWow64FsRedirection(ref IntPtr ptr);
+ ///
+ /// Initialize and disable file system redirection.
+ ///
private DeviceController()
{
IntPtr val = IntPtr.Zero;
Wow64DisableWow64FsRedirection(ref val);
}
+ ///
+ /// Get the DeviceController object singleton.
+ ///
+ /// DeviceController object singleton.
public static DeviceController GetInstance()
{
return new DeviceController();
}
- public void EnableDevice(String pnpDeviceId, bool enable)
+ ///
+ /// Enable or disable a device by the pnp device id.
+ ///
+ /// Identifier for the device.
+ /// Whether the device should be enabled or disabled.
+ public void EnableDevice(String pnpDeviceId, Boolean enable)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo
{
WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal,
- FileName = CMD,
+ FileName = cmdProcess,
UseShellExecute = true,
RedirectStandardOutput = false,
Verb = "runas"
};
- String command = enable ? ENABLE_DEVICE_COMMAND : DISABLE_DEVICE_COMMAND;
+ String command = enable ? enableDeviceCommand : disableDeviceCommand;
startInfo.Arguments = $"/C \"pnputil /{command} \"{pnpDeviceId}\"\"";
process.StartInfo = startInfo;
process.Start();
}
}
-}
-
-// pnputil is a tool default installed on computers with Windows Vista and up, which allows for easy modification of USB-devices.
-// Not working, attempt DevCon instead for removing a device, this isn't supported by pnputil.
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/IUSBSubsriber.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/IUSBSubsriber.cs
index 9b6ebec..90afe72 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/IUSBSubsriber.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/IUSBSubsriber.cs
@@ -9,7 +9,6 @@ namespace WPAppInstall.WindowsPhone.Hardware
///
/// Subscribe to USB-connected / USB-disconnected action.
///
-
public interface IUSBSubsriber
{
void NotifyConnected(String name);
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/NativeMethods.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/NativeMethods.cs
index e35add0..1e934ea 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/NativeMethods.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/NativeMethods.cs
@@ -8,13 +8,12 @@
namespace WPAppInstall.WindowsPhone.Hardware
{
///
- /// Import a few functions from PhoneRegDll which are being used.
+ /// Import a functions from PhoneRegDll which are being used.
///
-
public sealed class NativeMethods
{
[DllImport("PhoneRegDll.dll")]
- internal static extern uint GetWinPhone8Port(int port, out int portMapped);
+ internal static extern uint GetWinPhone8Port(Int32 port, out Int32 portMapped);
[DllImport("PhoneRegDll.dll")]
internal static extern int USBMonitorStart(NativeMethods.CallBack onConnected, NativeMethods.CallBack onDisconnected);
@@ -22,6 +21,6 @@ public sealed class NativeMethods
[DllImport("PhoneRegDll.dll")]
internal static extern int USBMonitorStop();
- public delegate void CallBack([MarshalAs(UnmanagedType.LPWStr)] string name);
+ public delegate void CallBack([MarshalAs(UnmanagedType.LPWStr)] String name);
}
}
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/ProductIds.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/ProductIds.cs
index e9ecf3b..6ff80ea 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/ProductIds.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/ProductIds.cs
@@ -11,10 +11,14 @@ namespace WPAppInstall.WindowsPhone.Hardware
///
/// Allows checking for existing Windows Phone devices.
///
-
public static class ProductIds
{
- public static bool Contains(String name)
+ ///
+ /// Check if the product name is known.
+ ///
+ /// Name of the device.
+ /// True or false for knowing or not known the product.
+ public static Boolean Contains(String name)
{
foreach (Devices device in Enum.GetValues(typeof(Devices)))
if (name.ToLower().Contains(device.ToString().ToLower()))
@@ -27,11 +31,17 @@ public static bool Contains(String name)
return false;
}
+ ///
+ /// Verify if the device series is known.
+ ///
public enum DeviceSeries
{
LUMIA
}
+ ///
+ /// Known Windows Phone devices.
+ ///
public enum Devices
{
// Windows Phone 7 Devices
@@ -153,11 +163,19 @@ public enum Devices
WIN_PHONE_50 // TREKSTOR
}
+ ///
+ /// Identifier to recognize Windows Phone 7 devices.
+ ///
private static readonly Dictionary productIds = new Dictionary()
{
{ "04EC", AppStrings.APP_WINDOWS_PHONE_7_DEVICE },
};
+ ///
+ /// Try to read more information with the product id.
+ ///
+ /// Identifier for the product.
+ /// String that contains more information about the product.
public static String GetPIDAddition(String pid)
{
String value;
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBConnectionHandler.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBConnectionHandler.cs
index 5ce939f..00ec57f 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBConnectionHandler.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBConnectionHandler.cs
@@ -10,138 +10,175 @@ namespace WPAppInstall.WindowsPhone.Hardware
///
/// Handle USB connections.
///
-
public class USBConnectionHandler
{
+ ///
+ /// Devices can be connected or disconnected using USB.
+ ///
public enum USBActions
{
Connect,
Disconnect
}
+ ///
+ /// This class contains actions specific for USB devices.
+ ///
public class USBDevice
{
+ ///
+ /// Ok or error are possible results for matching the regex.
+ ///
public enum RegexResults
{
Ok,
Error
}
- public readonly String vendorId;
- public readonly String productId;
- public readonly String guid;
- public readonly RegexResults result;
+ public readonly String VendorId;
+ public readonly String ProductId;
+ public readonly String Guid;
+ public readonly RegexResults RegexResult;
- private static readonly String REGEX_CHECK = ".*((VID)|(PID))+.*{.*}";
- private static readonly String REGEX_GUID = "{.+?}";
- private static readonly String REGEX_VID = "VID_.+?(&|#)";
- private static readonly String REGEX_PID = "PID_.+?(&|#)";
+ private static readonly String regexCheck = ".*((VID)|(PID))+.*{.*}";
+ private static readonly String regexGuid = "{.+?}";
+ private static readonly String regexVid = "VID_.+?(&|#)";
+ private static readonly String regexPid = "PID_.+?(&|#)";
+ ///
+ /// Create a usb device and it's corresponding properties by attempting to match regex patterns.
+ ///
+ /// Property string of the usb device.
public USBDevice(String usbPropertyString)
{
- Regex regex = new Regex(REGEX_CHECK);
+ Regex regex = new Regex(regexCheck);
Match match = regex.Match(usbPropertyString);
- result = match.Success ? RegexResults.Ok : RegexResults.Error;
+ RegexResult = match.Success ? RegexResults.Ok : RegexResults.Error;
- Match vendorIdRegex = new Regex(REGEX_VID).Match(usbPropertyString);
+ Match vendorIdRegex = new Regex(regexVid).Match(usbPropertyString);
if (vendorIdRegex.Success)
{
String vendorId = vendorIdRegex.Value;
- this.vendorId = vendorId.Substring(4, vendorId.Length - 4 - 1);
+ this.VendorId = vendorId.Substring(4, vendorId.Length - 4 - 1);
}
- Match productIdRegex = new Regex(REGEX_PID).Match(usbPropertyString);
+ Match productIdRegex = new Regex(regexPid).Match(usbPropertyString);
if (productIdRegex.Success)
{
String productId = productIdRegex.Value;
- this.productId = productId.Substring(4, productId.Length - 4 - 1);
+ this.ProductId = productId.Substring(4, productId.Length - 4 - 1);
}
- Match guidRegex = new Regex(REGEX_GUID).Match(usbPropertyString);
+ Match guidRegex = new Regex(regexGuid).Match(usbPropertyString);
if (guidRegex.Success)
{
String guid = guidRegex.Value;
- this.guid = guid.Substring(1, guid.Length - 1 - 1);
+ this.Guid = guid.Substring(1, guid.Length - 1 - 1);
}
}
}
- private IUSBSubsriber _subscriberUSB;
- private NativeMethods.CallBack _onUSBConnectedCallback;
- private NativeMethods.CallBack _onUSBDisconnectedCallback;
- private System.Timers.Timer _timer;
- private bool _timeoutUSB = false;
- private USBActions _lastUSBAction = USBActions.Disconnect;
- private Object _syncLock = new object();
- private Object _valueLock = new object();
-
+ private IUSBSubsriber subscriberUSB;
+ private NativeMethods.CallBack onUSBConnectedCallback;
+ private NativeMethods.CallBack onUSBDisconnectedCallback;
+ private System.Timers.Timer timer;
+ private Boolean timeoutUSB = false;
+ private USBActions lastUSBAction = USBActions.Disconnect;
+ private Object syncLock = new Object();
+ private Object valueLock = new Object();
+
+ ///
+ /// Create a usb connection handler.
+ ///
+ /// Callback for the usb connect or disconnect action.
public USBConnectionHandler(IUSBSubsriber subscriberUSB)
{
- _subscriberUSB = subscriberUSB;
+ this.subscriberUSB = subscriberUSB;
+
+ timer = new System.Timers.Timer(Utils.Constants.MinUsbTimeMillis);
+ timer.AutoReset = false;
+ timer.Elapsed += _timer_Elapsed;
- _timer = new System.Timers.Timer(Utils.Constants.MIN_USB_TIME_MILLIS);
- _timer.AutoReset = false;
- _timer.Elapsed += _timer_Elapsed;
+ onUSBConnectedCallback = new NativeMethods.CallBack(this.OnUSBConnected);
+ onUSBDisconnectedCallback = new NativeMethods.CallBack(this.OnUSBDisconnected);
- _onUSBConnectedCallback = new NativeMethods.CallBack(this.OnUSBConnected);
- _onUSBDisconnectedCallback = new NativeMethods.CallBack(this.OnUSBDisconnected);
- NativeMethods.USBMonitorStart(_onUSBConnectedCallback, _onUSBDisconnectedCallback);
+ NativeMethods.USBMonitorStart(onUSBConnectedCallback, onUSBDisconnectedCallback);
}
+ ///
+ /// If the timer elapsed, stop the timer and disable the usb timeout.
+ ///
private void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
- lock (_syncLock)
+ lock (syncLock)
{
- _timeoutUSB = false;
- _timer.Stop();
+ timeoutUSB = false;
+ timer.Stop();
}
}
- private bool VerifyTimer()
+ ///
+ /// Enable the usb timeout if previously set to false.
+ ///
+ /// Describes whether the usb timeout has been applied.
+ private Boolean VerifyTimer()
{
- lock (_syncLock)
- if (!_timeoutUSB)
+ lock (syncLock)
+ if (!timeoutUSB)
{
- _timer.Start();
- _timeoutUSB = true;
+ timer.Start();
+ timeoutUSB = true;
return true;
}
return false;
}
- private bool VerifyLastAction(USBActions calledFrom)
+ ///
+ /// Verify the last usb action.
+ ///
+ /// USBAction should be swapped.
+ /// Updates the last action if a lock can be acquired.
+ private Boolean VerifyLastAction(USBActions calledFrom)
{
- lock (_valueLock)
+ lock (valueLock)
{
- lock (_syncLock)
+ lock (syncLock)
{
- _timer.Stop();
- _timer.Start();
+ timer.Stop();
+ timer.Start();
}
if (calledFrom == USBActions.Connect)
- return _lastUSBAction == USBActions.Disconnect;
- else return _lastUSBAction == USBActions.Connect;
+ return lastUSBAction == USBActions.Disconnect;
+ else return lastUSBAction == USBActions.Connect;
}
}
+ ///
+ /// Notify the usb subscriber on a connect action.
+ ///
+ /// Name of the usb device connected
private void OnUSBConnected(String name)
{
if (VerifyTimer() || VerifyLastAction(USBActions.Connect))
- lock (_valueLock)
+ lock (valueLock)
{
- _subscriberUSB.NotifyConnected(name);
- _lastUSBAction = USBActions.Connect;
+ subscriberUSB.NotifyConnected(name);
+ lastUSBAction = USBActions.Connect;
}
}
+ ///
+ /// Notify the usb subscriber on a disconnect action.
+ ///
+ /// Name of the usb device disconnected
private void OnUSBDisconnected(String name)
{
if (VerifyTimer() || VerifyLastAction(USBActions.Disconnect))
- lock (_valueLock)
+ lock (valueLock)
{
- _subscriberUSB.NotifyDisconnected(name);
- _lastUSBAction = USBActions.Disconnect;
+ subscriberUSB.NotifyDisconnected(name);
+ lastUSBAction = USBActions.Disconnect;
}
}
}
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBScanner.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBScanner.cs
index a49609f..41ed780 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBScanner.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/USBScanner.cs
@@ -9,65 +9,75 @@
namespace WPAppInstall.WindowsPhone.Hardware
{
///
- /// Scan for USB-devices using a management-query.
+ /// Scan for usb devices using a management-query.
///
-
public static class USBScanner
{
- private static readonly String PROPERTY_DEVICE_ID = "DeviceID";
- private static readonly String PROPERTY_PNP_DEVICE_ID = "PNPDeviceID";
- private static readonly String PROPERTY_MANUFACTURER = "Manufacturer";
- private static readonly String PROPERTY_SERVICE = "Service";
- private static readonly String PROPERTY_PNP_CLASS = "PNPClass";
- private static readonly String PROPERTY_SYSTEM_NAME = "SystemName";
- private static readonly String PROPERTY_DESCRIPTION = "Description";
- private static readonly String PROPERTY_NAME = "Name";
- private static readonly String PROPERTY_CAPTION = "Caption";
- private static readonly String PROPERTY_STATUS = "Status";
- private static readonly String PROPERTY_CLASS_GUID = "ClassGuid";
- private static readonly String USB_QUERY = $"Select * From Win32_PnPEntity"; // Win32_PnPEntity // Select * From Win32_PnPEntity Where {PROPERTY_DEVICE_ID} Like \"USB%\"
- public static readonly USBScanner.FilterProperties FILTER_PROPERTIES_WINDOWS_PHONE = new USBScanner.FilterProperties((uint)USBScanner.FilterProperties.DeviceIdFilters.USB, (uint)USBScanner.FilterProperties.PNPClassFilters.WPD);
-
+ private static readonly String propertyDeviceId = "DeviceID";
+ private static readonly String propertyPnpDeviceId = "PNPDeviceID";
+ private static readonly String propertyManufacturer = "Manufacturer";
+ private static readonly String propertyService = "Service";
+ private static readonly String propertyPnpClass = "PNPClass";
+ private static readonly String propertySystemName = "SystemName";
+ private static readonly String propertyDescription = "Description";
+ private static readonly String propertyName = "Name";
+ private static readonly String propertyCaption = "Caption";
+ private static readonly String propertyStatus = "Status";
+ private static readonly String propertyClassGuid = "ClassGuid";
+ private static readonly String usbQuery = $"Select * From Win32_PnPEntity";
+ public static readonly USBScanner.FilterProperties FilterPropertiesWindowsPhone = new USBScanner.FilterProperties((uint)USBScanner.FilterProperties.DeviceIdFilters.Usb, (uint)USBScanner.FilterProperties.PNPClassFilters.Wpd);
+
+ ///
+ /// Properties for usb devices.
+ ///
public class USBDevice
{
- public String deviceId;
- public String pnpDeviceId;
- public String manufacturer;
- public String service;
- public String pnpClass;
- public String systemName;
- public String description;
- public String name;
- public String caption;
- public String status;
- public String classGuid;
+ public String DeviceId;
+ public String PnpDeviceId;
+ public String Manufacturer;
+ public String Service;
+ public String PnpClass;
+ public String SystemName;
+ public String Description;
+ public String Name;
+ public String Caption;
+ public String Status;
+ public String ClassGuid;
public USBDevice()
{
}
}
+ ///
+ /// Properties for filtering usb devices.
+ ///
public class FilterProperties
{
[Flags]
- public enum DeviceIdFilters : uint
+ public enum DeviceIdFilters : UInt32
{
- ANY = 0,
- USB = 1,
+ Any = 0,
+ Usb = 1,
}
[Flags]
- public enum PNPClassFilters : uint
+ public enum PNPClassFilters : UInt32
{
- ANY = 0,
- WPD = 1,
- USBDevice = 2,
+ Any = 0,
+ Wpd = 1,
+ UsbDevice = 2,
}
- public readonly uint deviceIdFilters;
- public readonly uint pnpClassFilters;
+ public readonly UInt32 deviceIdFilters;
+ public readonly UInt32 pnpClassFilters;
- public FilterProperties(uint deviceIdFilters, uint pnpClassFilters)
+ ///
+ /// Create the filter properties.
+ ///
+ /// Filter for the device id.
+ /// Filter for the pnp class.
+ public FilterProperties(UInt32 deviceIdFilters, UInt32 pnpClassFilters)
{
this.deviceIdFilters = deviceIdFilters;
this.pnpClassFilters = pnpClassFilters;
@@ -75,67 +85,66 @@ public FilterProperties(uint deviceIdFilters, uint pnpClassFilters)
}
}
+ ///
+ /// Get a list of the usb devices matching the specified filter.
+ ///
+ /// Filters applicable for getting the list.
+ /// List of usb devices matching the specified filter.
public static List GetUSBDevices(FilterProperties filterProperties)
{
List devices = new List();
ManagementObjectCollection collection;
- using (var searcher = new ManagementObjectSearcher(USB_QUERY))
+ using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(usbQuery))
collection = searcher.Get();
- foreach (var device in collection)
+ foreach (ManagementBaseObject device in collection)
{
USBDevice usbDevice = new USBDevice();
- String deviceId = (String)device.GetPropertyValue(PROPERTY_DEVICE_ID);
- usbDevice.deviceId = deviceId;
-
- String pnpDeviceId = (String)device.GetPropertyValue(PROPERTY_PNP_DEVICE_ID);
- usbDevice.pnpDeviceId = pnpDeviceId;
+ String deviceId = (String)device.GetPropertyValue(propertyDeviceId);
+ usbDevice.DeviceId = deviceId;
- String service = (String)device.GetPropertyValue(PROPERTY_SERVICE);
- usbDevice.service = service;
+ String pnpDeviceId = (String)device.GetPropertyValue(propertyPnpDeviceId);
+ usbDevice.PnpDeviceId = pnpDeviceId;
- String pnpClass = (String)device.GetPropertyValue(PROPERTY_PNP_CLASS);
- usbDevice.pnpClass = pnpClass;
+ String service = (String)device.GetPropertyValue(propertyService);
+ usbDevice.Service = service;
- String manufacturer = (String)device.GetPropertyValue(PROPERTY_MANUFACTURER);
- usbDevice.manufacturer = manufacturer;
+ String pnpClass = (String)device.GetPropertyValue(propertyPnpClass);
+ usbDevice.PnpClass = pnpClass;
- String systemName = (String)device.GetPropertyValue(PROPERTY_SYSTEM_NAME);
- usbDevice.systemName = systemName;
+ String manufacturer = (String)device.GetPropertyValue(propertyManufacturer);
+ usbDevice.Manufacturer = manufacturer;
- String descriptionId = (String)device.GetPropertyValue(PROPERTY_DESCRIPTION);
- usbDevice.description = descriptionId;
+ String systemName = (String)device.GetPropertyValue(propertySystemName);
+ usbDevice.SystemName = systemName;
- String name = (String)device.GetPropertyValue(PROPERTY_NAME);
- usbDevice.name = name;
+ String descriptionId = (String)device.GetPropertyValue(propertyDescription);
+ usbDevice.Description = descriptionId;
- String caption = (String)device.GetPropertyValue(PROPERTY_CAPTION);
- usbDevice.caption = caption;
+ String name = (String)device.GetPropertyValue(propertyName);
+ usbDevice.Name = name;
- String status = (String)device.GetPropertyValue(PROPERTY_STATUS);
- usbDevice.status = status;
+ String caption = (String)device.GetPropertyValue(propertyCaption);
+ usbDevice.Caption = caption;
- String classGuid = (String)device.GetPropertyValue(PROPERTY_CLASS_GUID);
- usbDevice.classGuid = classGuid;
+ String status = (String)device.GetPropertyValue(propertyStatus);
+ usbDevice.Status = status;
- if ((deviceId != null) && (filterProperties.deviceIdFilters & (uint)DeviceIdFilters.USB) == (uint)DeviceIdFilters.USB)
- {
- if (!deviceId.ToLower().Contains(DeviceIdFilters.USB.ToString().ToLower())) continue;
- }
+ String classGuid = (String)device.GetPropertyValue(propertyClassGuid);
+ usbDevice.ClassGuid = classGuid;
- if ((pnpClass != null) && (filterProperties.pnpClassFilters & (uint)PNPClassFilters.WPD) == (uint)PNPClassFilters.WPD)
- {
- if (!pnpClass.ToLower().Contains(PNPClassFilters.WPD.ToString().ToLower())) continue;
+ if ((deviceId != null) && (filterProperties.deviceIdFilters & (UInt32)DeviceIdFilters.Usb) == (UInt32)DeviceIdFilters.Usb)
+ if (!deviceId.ToLower().Contains(DeviceIdFilters.Usb.ToString().ToLower())) continue;
- }
+ if ((pnpClass != null) && (filterProperties.pnpClassFilters & (UInt32)PNPClassFilters.Wpd) == (UInt32)PNPClassFilters.Wpd)
+ if (!pnpClass.ToLower().Contains(PNPClassFilters.Wpd.ToString().ToLower())) continue;
- if ((pnpClass != null) && (filterProperties.pnpClassFilters & (uint)PNPClassFilters.USBDevice) == (uint)PNPClassFilters.USBDevice)
- {
- if (!pnpClass.ToLower().Contains(PNPClassFilters.USBDevice.ToString().ToLower())) continue;
- }
+ if ((pnpClass != null) && (filterProperties.pnpClassFilters & (UInt32)PNPClassFilters.UsbDevice) == (UInt32)PNPClassFilters.UsbDevice)
+ if (!pnpClass.ToLower().Contains(PNPClassFilters.UsbDevice.ToString().ToLower())) continue;
+
devices.Add(usbDevice);
}
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/VendorIds.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/VendorIds.cs
index 24050ae..8952a97 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/VendorIds.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware/VendorIds.cs
@@ -9,9 +9,11 @@ namespace WPAppInstall.WindowsPhone.Hardware
///
/// Check for known Windows Phone vendors.
///
-
public static class VendorIds
{
+ ///
+ /// List of companies that are registered vendors for Windows Phones.
+ ///
public enum Vendors
{
Nokia,
@@ -34,6 +36,9 @@ public enum Vendors
Alcatel
}
+ ///
+ /// Dictionary that matches the vendor based on a vendor id. Some vendors are not officially registered and use Microsofts id. An example of this is BLU.
+ ///
private static readonly Dictionary VENDOR_IDS = new Dictionary()
{
{ "0421", Vendors.Nokia },
@@ -58,16 +63,24 @@ public enum Vendors
{ "1BBB", Vendors.Alcatel }
};
+ ///
+ /// Check if the vendor exists based on the product name.
+ ///
+ /// Name of the product.
+ /// Matching vendor, null if not matching.
public static Vendors? Contains(String name)
{
foreach (Vendors vendor in Enum.GetValues(typeof(Vendors)))
- {
if (name.ToLower().Contains(vendor.ToString().ToLower()))
return vendor;
- }
return null;
}
+ ///
+ /// Check if the vendor exists based on the vendor id.
+ ///
+ /// Identifier of the vendor.
+ /// Matching vendor, null if not matching.
public static Vendors? GetVendor(String vendorId)
{
if (vendorId != null)
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware8.1/Hardware81.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware8.1/Hardware81.cs
index b51532f..251f8c9 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Hardware8.1/Hardware81.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Hardware8.1/Hardware81.cs
@@ -15,10 +15,9 @@ namespace WPAppInstall.WindowsPhone.Hardware8._1
///
/// This class provides functions to receive information from one connected Windows Phone, or perform actions on it.
///
-
public class Hardware81
{
- DeviceController _deviceController = DeviceController.GetInstance();
+ private DeviceController deviceController = DeviceController.GetInstance();
public Hardware81()
{
@@ -28,7 +27,6 @@ public Hardware81()
/// Enable / disable launching an application immediately after installation.
///
/// True or false for respectively launching or not launching an application after installation.
-
public void SetLaunchAppAfterInstall(bool launchAppAfterInstall)
{
Microsoft.Phone.Tools.Deploy.GlobalOptions.LaunchAfterInstall = launchAppAfterInstall;
@@ -38,7 +36,6 @@ public void SetLaunchAppAfterInstall(bool launchAppAfterInstall)
/// Scan for connectable devices.
///
/// Collection of ConnectableDevice instances.
-
public System.Collections.ObjectModel.Collection ScanDevices()
{
MultiTargetingConnectivity multiTargetingConnectivity = new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID);
@@ -51,7 +48,6 @@ public System.Collections.ObjectModel.Collection ScanDevices(
///
/// ConnectableDevice instance.
/// IDevice handle for device.
-
public Microsoft.SmartDevice.Connectivity.Interface.IDevice ConnectToDevice(ConnectableDevice connectableDevice)
{
Microsoft.SmartDevice.Connectivity.Interface.IDevice deviceHandle = connectableDevice.Connect(true);
@@ -62,7 +58,6 @@ public Microsoft.SmartDevice.Connectivity.Interface.IDevice ConnectToDevice(Conn
/// Disconnect from a device.
///
/// IDevice instance.
-
public void DisconnectFromDevice(Microsoft.SmartDevice.Connectivity.Interface.IDevice deviceHandle)
{
deviceHandle.Disconnect();
@@ -73,7 +68,6 @@ public void DisconnectFromDevice(Microsoft.SmartDevice.Connectivity.Interface.ID
///
/// IDevice instance.
/// IFileDeployer handle for device.
-
public Microsoft.SmartDevice.Connectivity.Interface.IFileDeployer GetFileDeployer(Microsoft.SmartDevice.Connectivity.Interface.IDevice deviceHandle)
{
return deviceHandle.GetFileDeployer();
@@ -84,7 +78,6 @@ public Microsoft.SmartDevice.Connectivity.Interface.IFileDeployer GetFileDeploye
///
/// IDevice instance.
/// Collection of IRemoteApplication instances.
-
public System.Collections.ObjectModel.Collection GetRemoteApplications(Microsoft.SmartDevice.Connectivity.Interface.IDevice deviceHandle)
{
return deviceHandle.GetInstalledApplications();
@@ -95,7 +88,6 @@ public Microsoft.SmartDevice.Connectivity.Interface.IFileDeployer GetFileDeploye
///
/// IDevice instance.
/// ISystemInfo instance.
-
public Microsoft.SmartDevice.Connectivity.Interface.ISystemInfo GetSystemInfo(Microsoft.SmartDevice.Connectivity.Interface.IDevice deviceHandle)
{
return deviceHandle.GetSystemInfo();
@@ -109,10 +101,9 @@ public Microsoft.SmartDevice.Connectivity.Interface.ISystemInfo GetSystemInfo(Mi
/// ManifestInfo from the app that should be installed.
/// Callback when app is deployed successfully / unsuccessfully.
/// Different types of deployment can be selected for different internal handling.
-
- public void DeployApplication(DeviceInfo deviceInfo, string appPath, IAppManifestInfo info, DeploymentOptions deploymentOptions)
+ public void DeployApplication(DeviceInfo deviceInfo, String appPath, IAppManifestInfo info, DeploymentOptions deploymentOptions)
{
- Microsoft.Phone.Tools.Deploy.Utils.InstallApplication(deviceInfo, info, deploymentOptions, appPath);
+ Microsoft.Phone.Tools.Deploy.Utils.InstallApplication(deviceInfo, info, deploymentOptions, appPath);
}
}
diff --git a/WPAppInstall/WPAppInstall/WindowsPhone/Utils/Constants.cs b/WPAppInstall/WPAppInstall/WindowsPhone/Utils/Constants.cs
index 64d825d..0edbf89 100644
--- a/WPAppInstall/WPAppInstall/WindowsPhone/Utils/Constants.cs
+++ b/WPAppInstall/WPAppInstall/WindowsPhone/Utils/Constants.cs
@@ -7,14 +7,13 @@
namespace WPAppInstall.WindowsPhone.Utils
{
///
- /// Class for keeping some constants.
+ /// Class for storing constants related to Windows Phone.
///
-
public static class Constants
{
- public static readonly int PHONE_PORT = 27077;
- public static readonly String ZUNE_PROCESS_NAME = "Zune";
- public static readonly String PHONE_IP_ADDRESS = "127.0.0.1";
- public static readonly int MIN_USB_TIME_MILLIS = 10000;
+ public static readonly Int32 WindowsPhonePort = 27077;
+ public static readonly String ZuneProcessName = "Zune";
+ public static readonly String PhoneIpAddress = "127.0.0.1";
+ public static readonly Int32 MinUsbTimeMillis = 10000;
}
}