/// <summary>
        /// Load a window
        /// </summary>
        /// <param name="parameter">The window name</param>
        public void LoadWindow(object parameter = null)
        {
            if (parameter is string)
            {
                string windowName = (string)parameter;

                switch (windowName)
                {
                case ("Shares"):
                {
                    ShareView sv = new ShareView();
                    sv.Show();
                    break;
                }

                case ("Network Adapters"):
                {
                    NetworkAdapterView nav = new NetworkAdapterView();
                    nav.Show();
                    break;
                }

                case ("IP4 Routes"):
                {
                    IP4RoutingTableView iprv = new IP4RoutingTableView();
                    iprv.Show();
                    break;
                }

                case ("User Sessions"):
                {
                    UserSessionView usv = new UserSessionView();
                    usv.Show();
                    break;
                }

                case ("Computer Sessions"):
                {
                    ComputerSessionView csv = new ComputerSessionView();
                    csv.Show();
                    break;
                }

                case ("Computer System"):
                {
                    ComputerSystemView cosv = new ComputerSystemView();
                    cosv.Show();
                    break;
                }

                case ("Environment Variables"):
                {
                    EnvironmentVariableView evv = new EnvironmentVariableView();
                    evv.Show();
                    break;
                }

                case ("Startup Entries"):
                {
                    StartupEntryView sev = new StartupEntryView();
                    sev.Show();
                    break;
                }

                case ("Recently Used"):
                {
                    RecentlyUsedEntryView reuv = new RecentlyUsedEntryView();
                    reuv.Show();
                    break;
                }

                case ("Updates"):
                {
                    UpdateView uv = new UpdateView();
                    uv.Show();
                    break;
                }

                case ("Processes"):
                {
                    ProcessView pv = new ProcessView();
                    pv.Show();
                    break;
                }

                case ("BIOS"):
                {
                    BIOSView vb = new BIOSView();
                    vb.Show();
                    break;
                }

                case ("Services"):
                {
                    WindowsServiceView wsv = new WindowsServiceView();
                    wsv.Show();
                    break;
                }

                case ("ARP Table"):
                {
                    ARPTableView atv = new ARPTableView();
                    atv.Show();
                    break;
                }

                case ("WLAN Sessions"):
                {
                    WLANSessionView wsv = new WLANSessionView();
                    wsv.Show();
                    break;
                }

                case ("Installed Programs"):
                {
                    InstalledProgramView ipv = new InstalledProgramView();
                    ipv.Show();
                    break;
                }

                case ("USB Device History"):
                {
                    USBDeviceHistoryView udhv = new USBDeviceHistoryView();
                    udhv.ShowDialog();
                    break;
                }

                case ("Users And Groups"):
                {
                    GroupUserView guv = new GroupUserView();
                    guv.ShowDialog();
                    break;
                }

                case ("User Assist"):
                {
                    UserAssistView uaw = new UserAssistView();
                    uaw.ShowDialog();
                    break;
                }

                case ("Recent Apps"):
                {
                    RecentAppView rav = new RecentAppView();
                    rav.ShowDialog();
                    break;
                }

                case ("Shim Cache"):
                {
                    ShimCacheView scv = new ShimCacheView();
                    scv.ShowDialog();
                    break;
                }

                case ("Prefetch"):
                {
                    PrefetchView pfv = new PrefetchView();
                    pfv.ShowDialog();
                    break;
                }

                case ("SRUM App Usage"):
                {
                    SRUMView sv = new SRUMView();
                    sv.ShowDialog();
                    break;
                }

                case ("SRUM Network Connectivity"):
                {
                    SRUMNetworkView snv = new SRUMNetworkView();
                    snv.ShowDialog();
                    break;
                }

                case ("BAM Data"):
                {
                    BAMView bv = new BAMView();
                    bv.ShowDialog();
                    break;
                }
                }
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            const string Space = " ";

            try
            {
                Console.WriteLine(@Resources.MessageApplicationInfo, Application.ProductVersion);
                _windowsServiceView = new WindowsServiceView();
                _presenterBuilder   = new PresenterBuilder(_windowsServiceView);
                _presenterBuilder.Build();
                // Start application.
                _windowsServiceView.Start(args);
                // Set started to true;
                _isStarted = true;
            }
            catch (InvalidDataException ex)
            {
                Console.Clear();
                Console.WriteLine(Application.ProductName + Space + Application.ProductVersion);
                Console.WriteLine(String.Empty);
                Console.WriteLine(@ex.Message);
                Console.WriteLine(String.Empty);
                Console.WriteLine(Resources.MessagePressAnyKeyToContinue);
                Console.ReadKey();
                Environment.Exit(255);
            }
            catch (XmlException ex)
            {
                Console.Clear();
                Console.WriteLine(Application.ProductName + Space + Application.ProductVersion);
                Console.WriteLine(String.Empty);
                Console.WriteLine(@ex.Message);
                Console.WriteLine(String.Empty);
                Console.WriteLine(Resources.MessagePressAnyKeyToContinue);
                Console.ReadKey();
                Environment.Exit(255);
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine(Application.ProductName + Space + Application.ProductVersion);
                Console.WriteLine(String.Empty);
                Console.WriteLine(@Resources.MessageUnexpectedError,
                                  @ex.Message);
                Console.WriteLine(String.Empty);
                Console.WriteLine(Resources.MessagePressAnyKeyToContinue);
                Console.ReadKey();
                Environment.Exit(255);
            }
            finally
            {
                // If not started successfully then dispose.
                if (!_isStarted)
                {
                    if (_presenterBuilder != null)
                    {
                        _presenterBuilder.Dispose();
                    }
                }
            }

            // If application was started.
            if (_isStarted)
            {
                Console.ReadLine();

                // Stop application.
                _windowsServiceView.Stop();

                if (_presenterBuilder != null)
                {
                    _presenterBuilder.Dispose();
                }
            }
        }