private Communication.PeripheralStatus CallFunctionWithProgressBar(SelectSettingWindow windowResult)
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            ProgressBarWindow progressBarWindow = new ProgressBarWindow("Communicating...", () =>
            {
                result = Communication.PeripheralStatus.Impossible;

                IPort port = null;

                try
                {
                    string portName     = SharedInformationManager.SelectedPortName;
                    string portSettings = SharedInformationManager.SelectedPortSettings;

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

                    result = CallFunction(windowResult, port);
                }
                catch (PortException)
                {
                }
                finally
                {
                    if (port != null)
                    {
                        Factory.I.ReleasePort(port);
                    }
                }
            });

            progressBarWindow.ShowDialog();

            return(result);
        }
Example #2
0
        private bool?ShowSelectDrawerOpenStatusWindow()
        {
            bool isHigh = true;

            SelectSettingWindow selectDrawerOpenStatusWindow = new SelectSettingWindow(FindResource("SelectDrawerOpenStatusWindow") as SelectSettingWindow);

            bool?result = selectDrawerOpenStatusWindow.ShowDialog();

            if (result == true)
            {
                switch (selectDrawerOpenStatusWindow.SelectedIndex)
                {
                default:
                case 0:
                    isHigh = true;
                    break;

                case 1:
                    isHigh = false;
                    break;
                }
            }
            else
            {
                return(null);
            }

            return(isHigh);
        }
        public override void Execute(object parameter)
        {
            bool isSelected = true;
            SelectSettingWindow selectPatterWindow = Function.SelectPatternWindow;

            if (Function.SelectPatternWindow != null)
            {
                selectPatterWindow.SelectedIndex = Function.DefaultPatternIndex;

                isSelected = (bool)selectPatterWindow.ShowDialog();
            }

            if (isSelected)
            {
                Communication.PeripheralStatus result = CallFunctionWithProgressBar(selectPatterWindow);

                if (result != Communication.PeripheralStatus.Connect ||
                    Function.Type == DisplayFunctionManager.FunctionType.CheckStatus)
                {
                    Communication.ShowPeripheralStatusResultMessage("Display", result);

                    return;
                }

                Communication.ShowCommunicationResultMessage(new CommunicationResult()
                {
                    Result = Communication.Result.Success, Code = StarResultCode.Succeeded
                });
            }
        }
Example #4
0
        public static bool ShowConfirmMessage(string caption, string message)
        {
            SelectSettingWindow confirmWindow = new SelectSettingWindow(caption, message);

            confirmWindow.Owner = GetMainWindow();
            confirmWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            return((bool)confirmWindow.ShowDialog());;
        }
        private static bool ShowDeleteConfigFileConfirmWindow()
        {
            SelectSettingWindow confirmWindow = new SelectSettingWindow();

            confirmWindow.Title        = "Confirm";
            confirmWindow.SettingTitle = "Delete AllReceipts config file?";

            return((bool)confirmWindow.ShowDialog());;
        }
Example #6
0
        public static void ShowMessage(string caption, string message)
        {
            SelectSettingWindow dialog = new SelectSettingWindow(caption, message, Visibility.Visible, Visibility.Collapsed);

            dialog.Owner = GetMainWindow();
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            dialog.ShowDialog();
        }
        private bool ShowModelConfirmWindow(ModelInformation.PrinterModel model)
        {
            ModelInformation modelInformation = new ModelInformation(model);

            SelectSettingWindow confirmWindow = new SelectSettingWindow();

            confirmWindow.Title = "Confirm";
            confirmWindow.AcceptButtonContent = "Yes";
            confirmWindow.CancelButtonContent = "No";
            confirmWindow.SettingTitle        = "Is your printer " + modelInformation.SimpleModelName + "?";

            return((bool)confirmWindow.ShowDialog());
        }
Example #8
0
        private Language ShowSelectLanguageWindow()
        {
            Language language = new Language();

            SelectSettingWindow selectLanguageWindow = new SelectSettingWindow(SelectLanguageWindow);

            bool result = (bool)selectLanguageWindow.ShowDialog();

            if (result)
            {
                language = selectLanguageWindow.SelecedLanguage;
            }

            return(language);
        }
Example #9
0
        private PaperSize ShowSelectPaperSizeWindow()
        {
            PaperSize paperSize = new PaperSize();

            SelectSettingWindow selectPaperSizeWindow = new SelectSettingWindow(SelectPaperSizeWindow);

            bool result = (bool)selectPaperSizeWindow.ShowDialog();

            if (result)
            {
                paperSize = selectPaperSizeWindow.SelecedPaperSize;
            }

            return(paperSize);
        }
Example #10
0
        private PaperSize ShowSelectPaperSizeWindow(PaperSizeType defaultPaperSize)
        {
            PaperSize paperSize = null;

            SelectSettingWindow selectPaperSizeWindow = new SelectSettingWindow(SelectSettingWindow.Templete.PaperSize);

            selectPaperSizeWindow.SelectedIndex = (int)defaultPaperSize;

            bool?result = selectPaperSizeWindow.ShowDialog();

            if (result == true)
            {
                paperSize = selectPaperSizeWindow.SelectedPaperSize;
            }

            return(paperSize);
        }
Example #11
0
        private ModelInformation ShowSelectModelWindow()
        {
            ModelInformation modelInformation = new ModelInformation();

            SelectSettingWindow selectModelWindow = new SelectSettingWindow(FindResource("SelectModelWindow") as SelectSettingWindow);

            bool?result = selectModelWindow.ShowDialog();

            if (result == true)
            {
                modelInformation = selectModelWindow.SelectedModel;
            }
            else
            {
                return(null);
            }

            return(modelInformation);
        }
        private static BlackMarkType?ShowSelectBlackMarkTypeWindow()
        {
            BlackMarkType?blackMarkType = null;

            SelectSettingWindow selectblackMarkWindow = new SelectSettingWindow(SelectSettingWindow.Templete.BlackMarkType);

            bool?result = selectblackMarkWindow.ShowDialog();

            if (result == true)
            {
                blackMarkType = selectblackMarkWindow.SelectedBlackMarkType;
            }
            else
            {
                return(null);
            }

            return(blackMarkType);
        }
Example #13
0
        private InterfaceInformation ShowSelectInterfaceWindow()
        {
            InterfaceInformation interfaceInformation = new InterfaceInformation();

            SelectSettingWindow selectInterfaceWindow = new SelectSettingWindow(FindResource("SelectInterfaceWindow") as SelectSettingWindow);

            bool?result = selectInterfaceWindow.ShowDialog();

            if (result == true)
            {
                interfaceInformation = selectInterfaceWindow.SelecedInterfaceType;
            }
            else
            {
                return(null);
            }

            return(interfaceInformation);
        }
        public static void ShowResultMessage(bool isSuccess)
        {
            string message = "";

            if (isSuccess)
            {
                message = "Success";
            }
            else
            {
                message = "Failure";
            }

            SelectSettingWindow resultDialog = new SelectSettingWindow("Result", message, Visibility.Visible, Visibility.Collapsed);

            resultDialog.Owner = Util.GetMainWindow();
            resultDialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            resultDialog.ShowDialog();
        }
        private static PrintableAreaType?ShowSelectPrintableAreaTypeWindow()
        {
            PrintableAreaType?type = null;

            SelectSettingWindow selectPrintableAreaTypeWindow = new SelectSettingWindow();

            selectPrintableAreaTypeWindow.Title         = "Select printable area type.";
            selectPrintableAreaTypeWindow.Settings      = new string[] { "Standard", "Type1", "Type2", "Type3", "Type4" };
            selectPrintableAreaTypeWindow.SelectedIndex = 0;

            bool?result = selectPrintableAreaTypeWindow.ShowDialog();

            if (result == true)
            {
                switch (selectPrintableAreaTypeWindow.SelectedIndex)
                {
                default:
                case 0:
                    type = PrintableAreaType.Standard;
                    break;

                case 1:
                    type = PrintableAreaType.Type1;
                    break;

                case 2:
                    type = PrintableAreaType.Type2;
                    break;

                case 3:
                    type = PrintableAreaType.Type3;
                    break;

                case 4:
                    type = PrintableAreaType.Type4;
                    break;
                }
            }

            return(type);
        }
        private bool ShowReconnectConfirmWindow()
        {
            if (isShowConfirmWindow)
            {
                return(false);
            }

            SelectSettingWindow confirmWindow = new SelectSettingWindow();

            confirmWindow.Title               = "Confirm";
            confirmWindow.SettingTitle        = "Printer driver job is completed. Start monitoring scale?";
            confirmWindow.AcceptButtonContent = "Yes";
            confirmWindow.CancelButtonContent = "No";

            isShowConfirmWindow = true;
            bool result = (bool)confirmWindow.ShowDialog();

            isShowConfirmWindow = false;

            return(result);
        }
        private bool ShowReleasePortConfirmWindow()
        {
            if (isShowConfirmWindow)
            {
                return(false);
            }

            SelectSettingWindow confirmWindow = new SelectSettingWindow();

            confirmWindow.Title               = "Confirm";
            confirmWindow.SettingTitle        = "Port is used, so can not print via printer driver. Release port?";
            confirmWindow.AcceptButtonContent = "Yes";
            confirmWindow.CancelButtonContent = "No";

            isShowConfirmWindow = true;
            bool result = (bool)confirmWindow.ShowDialog();

            isShowConfirmWindow = false;

            return(result);
        }
        public SelectSettingWindow(SelectSettingWindow sourceObject)
        {
            InitializeComponent();

            Title = sourceObject.Title;

            SettingTitle = sourceObject.SettingTitle;

            Settings = sourceObject.Settings;

            SelectedIndex = sourceObject.SelectedIndex;

            if (sourceObject.ModelInformations != null)
            {
                ModelInformations = sourceObject.ModelInformations;
            }

            if (sourceObject.InterfaceInformations != null)
            {
                InterfaceInformations = sourceObject.InterfaceInformations;
            }

            if (sourceObject.Languages != null)
            {
                Languages = sourceObject.Languages;
            }

            if (sourceObject.PaperSizeCollection != null)
            {
                PaperSizeCollection = sourceObject.PaperSizeCollection;
            }

            CheckRadioButton(selectedIndex);

            SetPosition();
        }
        private Communication.PeripheralStatus CallFunction(SelectSettingWindow windowResult, IPort port)
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            switch (Function.Type)
            {
            default:
            case DisplayFunctionManager.FunctionType.CheckStatus:
                result = DisplaySampleManager.GetDiaplayStatus(port);
                break;

            case DisplayFunctionManager.FunctionType.Text:
                result = DisplaySampleManager.DoTextPattern(windowResult.SelectedDisplayTextPattern, port);
                break;

            case DisplayFunctionManager.FunctionType.Graphic:
                result = DisplaySampleManager.DoGraphicPattern(windowResult.SelectedDisplayGraphicPattern, port);
                break;

            case DisplayFunctionManager.FunctionType.TurnOnOff:
                result = DisplaySampleManager.DoTurnOnOffPattern(windowResult.SelectedDisplayTurnOnOffPattern, port);
                break;

            case DisplayFunctionManager.FunctionType.Cursor:
                result = DisplaySampleManager.DoCursorPattern(windowResult.SelectedDisplayCursorPattern, port);
                break;

            case DisplayFunctionManager.FunctionType.Contrast:
                result = DisplaySampleManager.DoContrastPattern(windowResult.SelectedDisplayContrastPattern, port);
                break;

            case DisplayFunctionManager.FunctionType.CharacterSetInternational:
                DisplayInternationalType internationalType = windowResult.SelectedDisplayCharacterSetInternationalType;

                result = DisplaySampleManager.DoCharacterSetInternationalPattern(internationalType, port);

                SharedInformationManager.SelectedDisplayInternationalType = internationalType;
                break;

            case DisplayFunctionManager.FunctionType.CharacterSetCodePage:
                DisplayCodePageType codePageType = windowResult.SelectedDisplayCharacterSetCodePageType;

                result = DisplaySampleManager.DoCharacterSetCodePagePattern(codePageType, port);

                SharedInformationManager.SelectedDisplayCodePageType = codePageType;
                break;

            case DisplayFunctionManager.FunctionType.UserDefinedCharacter:
                bool set;
                if (windowResult.SelectedDisplayUserDefinedCharacterPattern == DisplayFunctionManager.UserDefinedCharacterPattern.Set)
                {
                    set = true;
                }
                else
                {
                    set = false;
                }

                result = DisplaySampleManager.DoUserDefinedCharacterPattern(set, port);
                break;
            }

            return(result);
        }