コード例 #1
0
        /// <summary>
        /// Handles the Click event of the btnStart control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            // save settings
            RockConfig rockConfig = RockConfig.Load();

            rockConfig.CheckinAddress = txtCheckinAddress.Text;

            int cacheLabelDuration;

            if (int.TryParse(txtCacheLabelDuration.Text, out cacheLabelDuration))
            {
                rockConfig.CacheLabelDuration = cacheLabelDuration;
            }

            /*double zoomLevel;
             * if (double.TryParse(txtZoomLevel.Text, out zoomLevel))
             * {
             *  rockConfig.ZoomLevel = zoomLevel;
             * }*/

            rockConfig.PrinterOverrideIp    = txtPrinterOverrideIp.Text;
            rockConfig.PrinterOverrideLocal = string.Empty;

            if (txtPrinterOverrideIp.Text == string.Empty)
            {
                foreach (Control control in spUsbPrinterList.Children)
                {
                    if (control is ToggleButton)
                    {
                        ToggleButton tbControl = control as ToggleButton;
                        if (tbControl.IsChecked != null && tbControl.IsChecked.Value == true)
                        {
                            rockConfig.PrinterOverrideLocal = tbControl.Content.ToString();
                        }
                    }
                }
            }

            rockConfig.Save();

            Uri uriTest;

            if (!Uri.TryCreate(txtCheckinAddress.Text, UriKind.Absolute, out uriTest))
            {
                MessageBox.Show("You must enter a valid URL for the Check-in Address Field.", "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                BrowserPage browserPage = new BrowserPage();
                this.NavigationService.Navigate(browserPage);
            }
        }
コード例 #2
0
ファイル: StartupPage.xaml.cs プロジェクト: Ganon11/Rock
        /// <summary>
        /// Handles the Click event of the btnStart control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnStart_Click( object sender, RoutedEventArgs e )
        {
            // save settings
            RockConfig rockConfig = RockConfig.Load();
            rockConfig.CheckinAddress = txtCheckinAddress.Text;

            int cacheLabelDuration;
            if (int.TryParse(txtCacheLabelDuration.Text, out cacheLabelDuration))
            {
                rockConfig.CacheLabelDuration = cacheLabelDuration;
            }

            if ( txtPrinterOverrideIp.Text != string.Empty )
            {
                rockConfig.PrinterOverrideIp = txtPrinterOverrideIp.Text;
                rockConfig.PrinterOverrideLocal = string.Empty;
            }
            else
            {
                foreach ( Control control in spUsbPrinterList.Children )
                {
                    if ( control is ToggleButton )
                    {
                        ToggleButton tbControl = control as ToggleButton;
                        if ( tbControl.IsChecked != null && tbControl.IsChecked.Value == true )
                        {
                            rockConfig.PrinterOverrideLocal = tbControl.Content.ToString();
                        }
                    }
                }
            }

            rockConfig.Save();
            
            Uri uriTest;
            if ( !Uri.TryCreate(txtCheckinAddress.Text, UriKind.Absolute, out uriTest ))
            {
                MessageBox.Show( "You must enter a valid URL for the Check-in Address Field.", "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation );
            }
            else
            {
                BrowserPage browserPage = new BrowserPage();
                this.NavigationService.Navigate( browserPage );
            }
        }
コード例 #3
0
ファイル: StartupPage.xaml.cs プロジェクト: jondhinkle/Rock
        private void btnStart_Click( object sender, RoutedEventArgs e )
        {
            // save settings
            Configuration configuration = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None );
            configuration.AppSettings.Settings["CheckinAddress"].Value = txtCheckinAddress.Text;
            
            configuration.AppSettings.Settings["CacheLabelDuration"].Value = txtCacheLabelDuration.Text;

            if ( txtPrinterOverrideIp.Text != string.Empty )
            {
                configuration.AppSettings.Settings["PrinterOverrideIp"].Value = txtPrinterOverrideIp.Text;
                configuration.AppSettings.Settings["PrinterOverrideLocal"].Value = "";
            }
            else
            {
                foreach ( Control control in spPrinterOverride.Children )
                {
                    if ( control is ToggleButton )
                    {
                        ToggleButton tbControl = control as ToggleButton;
                        if ( tbControl.IsChecked != null && tbControl.IsChecked.Value == true )
                        {
                            configuration.AppSettings.Settings["PrinterOverrideLocal"].Value = tbControl.Content.ToString();
                        }
                    }
                }
            }

            configuration.Save();

            ConfigurationManager.RefreshSection( "appSettings" );
            Uri uriTest;
            if ( !Uri.TryCreate(txtCheckinAddress.Text, UriKind.Absolute, out uriTest ))
            {
                MessageBox.Show( "You must enter a valid URL for the Check-in Address Field.", "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation );
            }
            else
            {
                BrowserPage browserPage = new BrowserPage();
                this.NavigationService.Navigate( browserPage );
            }
            
        }