Beispiel #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);
            }
        }
Beispiel #2
0
        private void frmMain_Loaded(object sender, RoutedEventArgs e)
        {
            closeButtonRestartTimer.Tick    += new EventHandler(closeButtonRestartTimer_Tick);
            closeButtonRestartTimer.Interval = new TimeSpan(0, 0, 10);

            RockCheckinScriptManager scriptManager = new RockCheckinScriptManager(this);

            wbMain.ObjectForScripting = scriptManager;
            wbMain.AllowDrop          = false;
            var rockConfig = RockConfig.Load();

            wbMain.Source = new Uri(rockConfig.CheckinAddress);

            puOverlay.IsOpen = true;
        }
        private void frmMain_Loaded(object sender, RoutedEventArgs e)
        {
            closeButtonRestartTimer.Tick    += new EventHandler(closeButtonRestartTimer_Tick);
            closeButtonRestartTimer.Interval = new TimeSpan(0, 0, 10);

            var rockConfig = RockConfig.Load();

            ScriptDirector scriptDirector = new ScriptDirector(this);

            wbWebBrowser.ObjectForScripting = scriptDirector;
            wbWebBrowser.AllowDrop          = true;

            wbWebBrowser.Navigate(rockConfig.CheckinAddress.ToString());

            puOverlay.IsOpen = true;
        }
Beispiel #4
0
        /// <summary>
        /// Prints the label.
        /// </summary>
        /// <param name="labelContents">The label contents.</param>
        /// <param name="labelPrinterIp">The label printer ip.</param>
        private void PrintLabel(string labelContents, string labelPrinterIp)
        {
            var rockConfig = RockConfig.Load();

            // if IP override
            if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideIp))
            {
                PrintViaIp(labelContents, rockConfig.PrinterOverrideIp);
            }
            else if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideLocal))   // if printer local
            {
                RawPrinterHelper.SendStringToPrinter(rockConfig.PrinterOverrideLocal, labelContents);
            }
            else // else print to given IP
            {
                PrintViaIp(labelContents, labelPrinterIp);
            }
        }
        /// <summary>
        /// Prints the label.
        /// </summary>
        /// <param name="labelContents">The label contents.</param>
        /// <param name="labelPrinterIp">The label printer ip.</param>
        private void PrintLabel(string labelContents, string labelPrinterIp)
        {
            var rockConfig = RockConfig.Load();

            // if IP override
            if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideIp))
            {
                PrintViaIp(labelContents, rockConfig.PrinterOverrideIp);
            }
            else if (!string.IsNullOrEmpty(rockConfig.PrinterOverrideLocal))   // if printer local
            {
                RawPrinterHelper.SendStringToPrinter(rockConfig.PrinterOverrideLocal, labelContents);
            }
            else if (!string.IsNullOrWhiteSpace(labelPrinterIp)) // else print to given IP
            {
                PrintViaIp(labelContents, labelPrinterIp);
            }
            else
            {
                MessageBox.Show("No printer has been configured.", "Print Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }