private Communication.PeripheralStatus CallDisplayFunction(DisplayFunctionManager.FunctionType type, int selectedIndex)
        {
            Communication.PeripheralStatus result = Communication.PeripheralStatus.Invalid;

            lock (lockObject)
            {
                switch (type)
                {
                case DisplayFunctionManager.FunctionType.Text:
                    result = DisplaySampleManager.DoTextPattern((DisplayFunctionManager.TextPattern)Enum.ToObject(typeof(DisplayFunctionManager.TextPattern), selectedIndex), port);
                    break;

                case DisplayFunctionManager.FunctionType.Graphic:
                    result = DisplaySampleManager.DoGraphicPattern((DisplayFunctionManager.GraphicPattern)Enum.ToObject(typeof(DisplayFunctionManager.GraphicPattern), selectedIndex), port);
                    break;

                case DisplayFunctionManager.FunctionType.TurnOnOff:
                    bool turnOn;
                    if (selectedIndex == 0)
                    {
                        turnOn = true;
                    }
                    else
                    {
                        turnOn = false;
                    }

                    result = DisplaySampleManager.DoTurnOnOffPattern(turnOn, port);
                    break;

                case DisplayFunctionManager.FunctionType.Cursor:
                    result = DisplaySampleManager.DoCursorPattern((DisplayCursorMode)Enum.ToObject(typeof(DisplayCursorMode), selectedIndex), port);
                    break;

                case DisplayFunctionManager.FunctionType.Contrast:
                    result = DisplaySampleManager.DoContrastPattern((DisplayContrastMode)Enum.ToObject(typeof(DisplayContrastMode), selectedIndex), port);
                    break;

                case DisplayFunctionManager.FunctionType.CharacterSetInternational:
                    DisplayInternationalType internationalType = (DisplayInternationalType)Enum.ToObject(typeof(DisplayInternationalType), selectedIndex);

                    result = DisplaySampleManager.DoCharacterSetInternationalPattern(internationalType, port);

                    SharedInformationManager.SetDisplayInternationalType(internationalType);
                    break;

                case DisplayFunctionManager.FunctionType.CharacterSetCodePage:
                    DisplayCodePageType codePageType = (DisplayCodePageType)Enum.ToObject(typeof(DisplayCodePageType), selectedIndex);

                    result = DisplaySampleManager.DoCharacterSetCodePagePattern(codePageType, port);

                    SharedInformationManager.SetDisplayCodePageType(codePageType);
                    break;

                case DisplayFunctionManager.FunctionType.UserDefinedCharacter:
                    bool set;
                    if ((DisplayFunctionManager.UserDefinedCharacterPattern)Enum.ToObject(typeof(DisplayFunctionManager.UserDefinedCharacterPattern), selectedIndex) == DisplayFunctionManager.UserDefinedCharacterPattern.Set)
                    {
                        set = true;
                    }
                    else
                    {
                        set = false;
                    }

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

                default:
                    break;
                }
            }

            return(result);
        }
        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);
        }