Пример #1
0
        private void PerformBrowseServers()
        {
            var bsvm = new BrowseServerViewModel();
            var dlg  = new BrowseServer();

            dlg.DataContext = bsvm;
            var result = dlg.ShowDialog();

            ServerManager.SaveServerListToDisk();
        }
Пример #2
0
        private void btnEditServers_Click(object sender, RoutedEventArgs e)
        {
            MainWindowDisable();

            EditServersViewModel vm  = new EditServersViewModel();
            EditServersWindow    win = new EditServersWindow(vm);

            win.ShowDialog();

            // Save any changes the user made to disk
            ServerManager.SaveServerListToDisk();

            if (vm.AddServerRequested)
            {
                var dlg = new AddServer();
                // AddServer saves anything added to disk (via ServerManager)
                var result = dlg.ShowDialog();
                if (IsTrue(result))
                {
                    PopulateServerList();
                    LoadUserAccounts(initialLoad: false);
                }
            }
            else if (vm.BrowseServerRequested)
            {
                var bsvm = new BrowseServerViewModel();
                var dlg  = new BrowseServer();
                dlg.DataContext = bsvm;
                var result = dlg.ShowDialog();
                // Save any changes the user made to disk
                ServerManager.SaveServerListToDisk();
                // In case user added any servers
                PopulateServerList();
                LoadUserAccounts(initialLoad: false);
            }
            else if (vm.ServersDeleted)
            {
                PopulateServerList();
                LoadUserAccounts(initialLoad: false);
            }
            MainWindowEnable();
        }