Beispiel #1
0
        public static Communication.CommunicationResult ParseDoNotCheckConditionWithProgressBar(IPeripheralCommandParser parser, IPort port)
        {
            Communication.CommunicationResult result = Communication.CommunicationResult.ErrorUnknown;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = ParseDoNotCheckCondition(parser, port);
            });

            progressBarWindow.ShowDialog();

            return(result);
        }
        public static CommunicationResult InitializeUSBSerialNumberWithProgressBar(bool isEnabled, string portName, string portSettings, int timeout)
        {
            CommunicationResult result = new CommunicationResult();

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = InitializeUSBSerialNumber(isEnabled, portName, portSettings, timeout);
            });

            progressBarWindow.ShowDialog();

            return(result);
        }
        public static CommunicationResult SetUSBSerialNumberWithProgressBar(byte[] serialNumber, bool isEnabled, IPort port)
        {
            CommunicationResult result = new CommunicationResult();

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = SetUSBSerialNumber(serialNumber, isEnabled, port);
            });

            progressBarWindow.ShowDialog();

            return(result);
        }
        private void CallDisplayFunctionWithProgressBar(DisplayFunctionManager.FunctionType type, int selectedIndex)
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = CallDisplayFunction(type, selectedIndex);
            });

            progressBarWindow.ShowDialog();

            if (result != Communication.PeripheralStatus.Connect)
            {
                Communication.ShowPeripheralStatusResultMessage("Display", result);
            }
        }
        private void SendUnitChangeCommandsWithProgressBar()
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = SendUnitChangeCommands();
            });

            progressBarWindow.ShowDialog();

            if (result != Communication.PeripheralStatus.Connect)
            {
                Communication.ShowPeripheralStatusResultMessage("Scale", result);
            }
        }
        public static CommunicationResult GetProductSerialNumberWithProgressBar(ref string serialNumber, string portName, string portSettings, int timeout)
        {
            CommunicationResult result = new CommunicationResult();

            string temp = "";

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = GetProductSerialNumber(ref temp, portName, portSettings, timeout);
            });

            progressBarWindow.ShowDialog();

            serialNumber = temp;

            return(result);
        }
Beispiel #7
0
        public static CommunicationResult GetSerialNumberWithProgressBar(ref string serialNumber, IPort port)
        {
            CommunicationResult result = CommunicationResult.ErrorUnknown;

            string temp = "";

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = GetSerialNumber(ref temp, port);
            });

            progressBarWindow.ShowDialog();

            serialNumber = temp;

            return(result);
        }
        public static void SendCommandsForRedirectionWithProgressBar(byte[] commands, string[] portNameArray, string[] portSettingsArray, int[] timeoutMillisArray)
        {
            CommunicationResult[] results = (CommunicationResult[])Enumerable.Empty <CommunicationResult>();;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                results = SendCommandsForRedirection(commands, portNameArray, portSettingsArray, timeoutMillisArray);
            });

            progressBarWindow.ShowDialog();

            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < results.Length; i++)
            {
                if (i == 0)
                {
                    builder.Append("[Destination]");
                }
                else
                {
                    builder.Append("[Backup]");
                }

                builder.Append(Environment.NewLine);
                builder.Append("Port Name : ");
                builder.Append(portNameArray[i]);
                builder.Append(" ->");
                builder.Append(Environment.NewLine);
                builder.Append(GetCommunicationResultMessage(results[i]));

                if (i != results.Length - 1)
                {
                    builder.Append(Environment.NewLine);
                    builder.Append(Environment.NewLine);
                }
            }

            MessageBox.Show(builder.ToString(), "Communication Result");
        }
        private void GetBluetoothSettingsWithProgressBar()
        {
            string errorMessage = null;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                errorMessage = GetBluetoothSettings();
            });

            progressBarWindow.ShowDialog();

            if (errorMessage == null)
            {
                ShowBlueoothSettings();
            }
            else
            {
                MessageBox.Show(errorMessage, "Error");

                SetAllFunctionDisable();
            }
        }
Beispiel #10
0
        public static Communication.PeripheralStatus CallScaleFunctionWithProgressBar(CallScaleFunctionClickEvent.ScallFunctionType type, ref DisplayedWeightStatus weightStatus, ref string weight)
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            DisplayedWeightStatus tempWeightStatus = DisplayedWeightStatus.Invalid;
            string tempWeight = "";

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                IPort port = null;

                try
                {
                    string portName     = SharedInformationManager.GetSelectedPortName();
                    string portSettings = SharedInformationManager.GetSelectedPortStrrings();

                    port = Factory.I.GetPort(portName, portSettings, 30000);

                    result = CallScaleFunction(type, port, ref tempWeightStatus, ref tempWeight);
                }
                catch (PortException)
                {
                }
                finally
                {
                    if (port != null)
                    {
                        Factory.I.ReleasePort(port);
                    }
                }
            });

            progressBarWindow.ShowDialog();

            weightStatus = tempWeightStatus;
            weight       = tempWeight;

            return(result);
        }
Beispiel #11
0
        private void ReloadDeviceInformationWithProgressBar()
        {
            deviceStatusListBox.ItemsSource        = null;
            firmwareInformationListBox.ItemsSource = null;

            StarPrinterStatus           status = null;
            Dictionary <string, string> firmwareInformation = null;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                status = GetDeviceStatus();

                if (status == null)
                {
                    return;
                }

                Thread.Sleep(1000);

                firmwareInformation = GetFirmwareInformation();
            });

            progressBarWindow.ShowDialog();

            if (status == null && firmwareInformation == null) // Communication failure.
            {
                MessageBox.Show("Communication error", "Error");

                return;
            }

            // Parse printer status.
            ParsePrinterStatus(status, SharedInformationManager.SelectedDrawerOpenStatus);

            // Parse firmware information.
            ParseFirmwareInformation(firmwareInformation);
        }