コード例 #1
0
 private void Settings_OnClick(object sender, RoutedEventArgs e)
 {
     var settingsForm = new Settings(SaveSettingsCallback);
     settingsForm.ShowDialog();
 }
コード例 #2
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            //Get setting from the app config
            _AppId = Properties.Settings.Default.AppId;
            _DomainUrl = Properties.Settings.Default.DomainUrl;
            _PageId = Properties.Settings.Default.PageId;
            _LoginUrl = string.Format(URL_TEMPLATE, _AppId, _DomainUrl);
            _LoginForm = new Login(LoginCallback, _LoginUrl , "");

            //Plugin the view model
            _ViewModel = new MainWindowViewModel { CsvFileLocation = string.Empty };
            DataContext = _ViewModel;

            //Disable app buttons until after the user has settings and is logged in
            LoginMenu.IsEnabled = false;
            BrowseForFiles.IsEnabled = false;

            //Make sure that there are settings in place
            if (string.IsNullOrEmpty(_AppId) || string.IsNullOrEmpty(_DomainUrl) || string.IsNullOrEmpty(_PageId))
            {
                var settingsForm = new Settings(SaveSettingsCallback);
                settingsForm.ShowDialog();

                DisableLogin();
            }
            else
            {
                //Make sure that the user is logged in.
                _LoginForm.LoginUser();
                _LoginForm.ShowDialog();
                LoginMenu.Visibility = Visibility.Visible;
                EnableLogin();
            }

            DisableBrowse();
        }