private void LoadSettings()
        {
            // General
            _settingsViewsSource = new CollectionViewSource()
            {
                Source = SettingsViewManager.List
            };

            SettingsViews.GroupDescriptions.Add(new PropertyGroupDescription("TranslatedGroup"));
            SettingsViews.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));

            SettingsViews.Filter = o =>
            {
                if (string.IsNullOrEmpty(Search))
                {
                    return(true);
                }

                // Settings view without "-" and " "
                SettingsViewInfo info = o as SettingsViewInfo;

                Regex regex = new Regex(@" |-");

                string search = regex.Replace(Search, "");

                // Search by TranslatedName and Name
                return((regex.Replace(info.TranslatedName, "").IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1) || (regex.Replace(info.Name.ToString(), "").IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1));
            };
        }
 public void ChangeSettingsView(ApplicationViewManager.Name applicationName)
 {
     if (Enum.GetNames(typeof(SettingsViewManager.Name)).Contains(applicationName.ToString()) && ApplicationViewManager.Name.None.ToString() != applicationName.ToString())
     {
         SelectedSettingsView = SettingsViews.SourceCollection.Cast <SettingsViewInfo>().FirstOrDefault(x => x.Name.ToString() == applicationName.ToString());
     }
     else
     {
         SelectedSettingsView = SettingsViews.SourceCollection.Cast <SettingsViewInfo>().FirstOrDefault(x => x.Name == SettingsViewManager.Name.General);
     }
 }
        private void ChangeSettingsContent(SettingsViewInfo settingsViewInfo)
        {
            switch (settingsViewInfo.Name)
            {
            case SettingsViewManager.Name.General:
                if (_settingsGeneralGerneralView == null)
                {
                    _settingsGeneralGerneralView = new SettingsGeneralGeneralView();
                }

                SettingsContent = _settingsGeneralGerneralView;
                break;

            case SettingsViewManager.Name.Window:
                if (_settingsGeneralWindowView == null)
                {
                    _settingsGeneralWindowView = new SettingsGeneralWindowView();
                }

                SettingsContent = _settingsGeneralWindowView;
                break;

            case SettingsViewManager.Name.Appearance:
                if (_settingsGeneralApperanceView == null)
                {
                    _settingsGeneralApperanceView = new SettingsGeneralAppearanceView();
                }

                SettingsContent = _settingsGeneralApperanceView;
                break;

            case SettingsViewManager.Name.Language:
                if (_settingsGeneralLanguageView == null)
                {
                    _settingsGeneralLanguageView = new SettingsGeneralLanguageView();
                }

                SettingsContent = _settingsGeneralLanguageView;
                break;

            case SettingsViewManager.Name.HotKeys:
                if (_settingsGeneralHotKeysView == null)
                {
                    _settingsGeneralHotKeysView = new SettingsGeneralHotKeysView();
                }

                SettingsContent = _settingsGeneralHotKeysView;
                break;

            case SettingsViewManager.Name.Autostart:
                if (_settingsGeneralAutostartView == null)
                {
                    _settingsGeneralAutostartView = new SettingsGeneralAutostartView();
                }

                SettingsContent = _settingsGeneralAutostartView;
                break;

            case SettingsViewManager.Name.Settings:
                if (_settingsGeneralSettingsView == null)
                {
                    _settingsGeneralSettingsView = new SettingsGeneralSettingsView();
                }

                // Save settings (if changed) and check if files exists
                _settingsGeneralSettingsView.SaveAndCheckSettings();

                SettingsContent = _settingsGeneralSettingsView;
                break;

            case SettingsViewManager.Name.Update:
                if (_settingsGeneralUpdateView == null)
                {
                    _settingsGeneralUpdateView = new SettingsGeneralUpdateView();
                }

                SettingsContent = _settingsGeneralUpdateView;
                break;

            case SettingsViewManager.Name.ImportExport:
                if (_settingsGeneralImportExportView == null)
                {
                    _settingsGeneralImportExportView = new SettingsGeneralImportExportView();
                }

                // Save settings (if changed) and check if files exists
                _settingsGeneralImportExportView.SaveAndCheckSettings();

                SettingsContent = _settingsGeneralImportExportView;
                break;

            case SettingsViewManager.Name.IPScanner:
                if (_settingsApplicationIPScannerView == null)
                {
                    _settingsApplicationIPScannerView = new SettingsApplicationIPScannerView();
                }

                SettingsContent = _settingsApplicationIPScannerView;
                break;

            case SettingsViewManager.Name.PortScanner:
                if (_settingsApplicationPortScannerView == null)
                {
                    _settingsApplicationPortScannerView = new SettingsApplicationPortScannerView();
                }

                SettingsContent = _settingsApplicationPortScannerView;
                break;

            case SettingsViewManager.Name.Ping:
                if (_settingsApplicationPingView == null)
                {
                    _settingsApplicationPingView = new SettingsApplicationPingView();
                }

                SettingsContent = _settingsApplicationPingView;
                break;

            case SettingsViewManager.Name.Traceroute:
                if (_settingsApplicationTracerouteView == null)
                {
                    _settingsApplicationTracerouteView = new SettingsApplicationTracerouteView();
                }

                SettingsContent = _settingsApplicationTracerouteView;
                break;

            case SettingsViewManager.Name.DNSLookup:
                if (_settingsApplicationDNSLookupView == null)
                {
                    _settingsApplicationDNSLookupView = new SettingsApplicationDNSLookupView();
                }

                SettingsContent = _settingsApplicationDNSLookupView;
                break;

            case SettingsViewManager.Name.RemoteDesktop:
                if (_settingsApplicationRemoteDesktopView == null)
                {
                    _settingsApplicationRemoteDesktopView = new SettingsApplicationRemoteDesktopView();
                }

                SettingsContent = _settingsApplicationRemoteDesktopView;
                break;

            case SettingsViewManager.Name.SNMP:
                if (_settingsApplicationSNMPView == null)
                {
                    _settingsApplicationSNMPView = new SettingsApplicationSNMPView();
                }

                SettingsContent = _settingsApplicationSNMPView;
                break;

            case SettingsViewManager.Name.WakeOnLAN:
                if (_settingsApplicationWakeOnLANView == null)
                {
                    _settingsApplicationWakeOnLANView = new SettingsApplicationWakeOnLANView();
                }

                SettingsContent = _settingsApplicationWakeOnLANView;
                break;

            case SettingsViewManager.Name.HTTPHeaders:
                if (_settingsApplicationHTTPHeadersView == null)
                {
                    _settingsApplicationHTTPHeadersView = new SettingsApplicationHTTPHeadersView();
                }

                SettingsContent = _settingsApplicationHTTPHeadersView;
                break;
            }
        }
Exemplo n.º 4
0
        private void ChangeSettingsContent(SettingsViewInfo settingsViewInfo)
        {
            switch (settingsViewInfo.Name)
            {
            case SettingsViewManager.Name.General:
                if (_settingsGerneralView == null)
                {
                    _settingsGerneralView = new SettingsGeneralView();
                }

                SettingsContent = _settingsGerneralView;
                break;

            case SettingsViewManager.Name.Window:
                if (_settingsWindowView == null)
                {
                    _settingsWindowView = new SettingsWindowView();
                }

                SettingsContent = _settingsWindowView;
                break;

            case SettingsViewManager.Name.Appearance:
                if (_settingsApperanceView == null)
                {
                    _settingsApperanceView = new SettingsAppearanceView();
                }

                SettingsContent = _settingsApperanceView;
                break;

            case SettingsViewManager.Name.Language:
                if (_settingsLanguageView == null)
                {
                    _settingsLanguageView = new SettingsLanguageView();
                }

                SettingsContent = _settingsLanguageView;
                break;

            case SettingsViewManager.Name.HotKeys:
                if (_settingsHotKeysView == null)
                {
                    _settingsHotKeysView = new SettingsHotKeysView();
                }

                SettingsContent = _settingsHotKeysView;
                break;

            case SettingsViewManager.Name.Autostart:
                if (_settingsAutostartView == null)
                {
                    _settingsAutostartView = new SettingsAutostartView();
                }

                SettingsContent = _settingsAutostartView;
                break;

            case SettingsViewManager.Name.Settings:
                if (_settingsSettingsView == null)
                {
                    _settingsSettingsView = new SettingsSettingsView();
                }

                // Save settings (if changed) and check if files exists
                _settingsSettingsView.SaveAndCheckSettings();

                SettingsContent = _settingsSettingsView;
                break;

            case SettingsViewManager.Name.Update:
                if (_settingsUpdateView == null)
                {
                    _settingsUpdateView = new SettingsUpdateView();
                }

                SettingsContent = _settingsUpdateView;
                break;

            case SettingsViewManager.Name.ImportExport:
                if (_settingsImportExportView == null)
                {
                    _settingsImportExportView = new SettingsImportExportView();
                }

                // Save settings (if changed) and check if files exists
                _settingsImportExportView.SaveAndCheckSettings();

                SettingsContent = _settingsImportExportView;
                break;

            case SettingsViewManager.Name.IPScanner:
                if (_ipScannerSettingsView == null)
                {
                    _ipScannerSettingsView = new IPScannerSettingsView();
                }

                SettingsContent = _ipScannerSettingsView;
                break;

            case SettingsViewManager.Name.PortScanner:
                if (_portScannerSettingsView == null)
                {
                    _portScannerSettingsView = new PortScannerSettingsView();
                }

                SettingsContent = _portScannerSettingsView;
                break;

            case SettingsViewManager.Name.Ping:
                if (_pingSettingsViewModel == null)
                {
                    _pingSettingsViewModel = new PingSettingsView();
                }

                SettingsContent = _pingSettingsViewModel;
                break;

            case SettingsViewManager.Name.Traceroute:
                if (_tracerouteSettingsView == null)
                {
                    _tracerouteSettingsView = new TracerouteSettingsView();
                }

                SettingsContent = _tracerouteSettingsView;
                break;

            case SettingsViewManager.Name.DNSLookup:
                if (_dnsLookupSettingsViewModel == null)
                {
                    _dnsLookupSettingsViewModel = new DNSLookupSettingsView();
                }

                SettingsContent = _dnsLookupSettingsViewModel;
                break;

            case SettingsViewManager.Name.RemoteDesktop:
                if (_remoteDesktopSettingsView == null)
                {
                    _remoteDesktopSettingsView = new RemoteDesktopSettingsView();
                }

                SettingsContent = _remoteDesktopSettingsView;
                break;

            case SettingsViewManager.Name.PuTTY:
                if (_puTTYSettingsView == null)
                {
                    _puTTYSettingsView = new PuTTYSettingsView();
                }

                SettingsContent = _puTTYSettingsView;
                break;

            case SettingsViewManager.Name.SNMP:
                if (_snmpSettingsView == null)
                {
                    _snmpSettingsView = new SNMPSettingsView();
                }

                SettingsContent = _snmpSettingsView;
                break;

            case SettingsViewManager.Name.WakeOnLAN:
                if (_wakeOnLANSettingsView == null)
                {
                    _wakeOnLANSettingsView = new WakeOnLANSettingsView();
                }

                SettingsContent = _wakeOnLANSettingsView;
                break;

            case SettingsViewManager.Name.HTTPHeaders:
                if (_httpHeadersSettingsView == null)
                {
                    _httpHeadersSettingsView = new HTTPHeadersSettingsView();
                }

                SettingsContent = _httpHeadersSettingsView;
                break;
            }
        }