예제 #1
0
        private void DrawButton(int buttonIndex, ButtonTypeEnum buttonType)
        {
            ColorsConfig buttonColors = GetButtonColors(buttonIndex);

            var button = CreateDesktopButton(buttonColors, buttonIndex, buttonType);

            PlaceButton(button);
            _Buttons[buttonIndex] = button;
        }
예제 #2
0
        public static async Task <string> HandleSaveMediaInputAsync(string varName, ButtonTypeEnum buttonType)
        {
            FileOpenPicker fop = new FileOpenPicker()
            {
                CommitButtonText = "Done"
            };

            if (buttonType == ButtonTypeEnum.GetImage)
            {
                fop.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                fop.ViewMode = PickerViewMode.Thumbnail;
                fop.FileTypeFilter.Add(".jpg");
                fop.FileTypeFilter.Add(".jpeg");
                fop.FileTypeFilter.Add(".png");
                fop.FileTypeFilter.Add(".bmp");
                fop.FileTypeFilter.Add(".gif");
            }
            else if (buttonType == ButtonTypeEnum.GetVideo)
            {
                fop.SuggestedStartLocation = PickerLocationId.VideosLibrary;
                fop.ViewMode = PickerViewMode.Thumbnail;
                fop.FileTypeFilter.Add(".mp4");
                fop.FileTypeFilter.Add(".avi");
                fop.FileTypeFilter.Add(".wmv");
            }
            else if (buttonType == ButtonTypeEnum.GetAudio)
            {
                fop.SuggestedStartLocation = PickerLocationId.MusicLibrary;
                fop.ViewMode = PickerViewMode.List;
                fop.FileTypeFilter.Add(".mp3");
                fop.FileTypeFilter.Add(".wav");
                fop.FileTypeFilter.Add(".wma");
            }
            else if (buttonType == ButtonTypeEnum.GetFile)
            {
                fop.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
                fop.ViewMode = PickerViewMode.List;
                fop.FileTypeFilter.Add("*");
            }
            var sf = await fop.PickSingleFileAsync();

            if (sf != null)
            {
                var fileUploadResp = await APIHelper.UploadFile(sf.Name, sf);

                if (fileUploadResp != null && fileUploadResp.links != null && fileUploadResp.links.Length > 0)
                {
                    if (!string.IsNullOrWhiteSpace(varName))
                    {
                        Utils.LocalStore[varName] = fileUploadResp.links[0].href;
                    }
                    return(fileUploadResp.links[0].href);
                }
            }
            return(null);
        }
예제 #3
0
 public ButtonElement()
 {
     this.mType      = ButtonTypeEnum.Reply;
     this.mState     = ButtonStateEnum.Normal;
     this.mType      = ButtonTypeEnum.Reply;
     this.mState     = ButtonStateEnum.Normal;
     this.mPressedID = 248;
     this.mNormalID  = 247;
     this.RefreshCache();
 }
예제 #4
0
 public ButtonTemplate(ButtonTypeEnum type, string name, string icon, string text, int defaultPosition, int manipulationPosition)
 {
     Type                 = type;
     Name                 = name;
     Icon                 = icon;
     Text                 = text;
     DefaultPosition      = defaultPosition;
     ManipulationPosition = manipulationPosition;
     EventTarget          = null;
     OnTappedEvent        = null;
 }
예제 #5
0
        /// <summary>
        /// Instantiates a dialog and passes a generated result
        /// </summary>
        /// <param name="dialogPrefab"></param>
        /// <param name="buttons"></param>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static SimpleDialog Open(GameObject dialogPrefab, ButtonTypeEnum buttons, string title, string message)
        {
            GameObject         dialogGo = GameObject.Instantiate(dialogPrefab) as GameObject;
            SimpleDialog       dialog   = dialogGo.GetComponent <SimpleDialog>();
            SimpleDialogResult result   = new SimpleDialogResult();

            result.Buttons = buttons;
            result.Title   = title;
            result.Message = message;
            dialog.Launch(result);
            return(dialog);
        }
        private void CreateButton(ButtonTypeEnum type)
        {
            GameObject newButton = GameObject.Instantiate(SquareButtonPrefab, buttonParent);

            newButton.transform.localPosition = Vector3.zero;
            newButton.transform.localRotation = Quaternion.identity;
            ManipulationToolbarButton mtb = newButton.AddComponent <ManipulationToolbarButton>();

            mtb.Type          = type;
            mtb.ParentToolbar = this;

            RegisterInteractible(newButton);
        }
예제 #7
0
 protected ButtonElement(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     this.mType  = ButtonTypeEnum.Reply;
     this.mState = ButtonStateEnum.Normal;
     info.GetInt32("ButtonElementVersion");
     this.mPressedID  = info.GetInt32(nameof(PressedID));
     this.mNormalID   = info.GetInt32(nameof(NormalID));
     this.mType       = (ButtonTypeEnum)info.GetInt32(nameof(Type));
     this.mState      = (ButtonStateEnum)info.GetInt32(nameof(State));
     this.mCodeBehind = info.GetString("CodeBehind");
     this.mParam      = info.GetInt32(nameof(Param));
     this.RefreshCache();
 }
예제 #8
0
        public AddButton(Guid _guid, JoystickHelper helper, ButtonTypeEnum _buttonType)
        {
            InitializeComponent();

            joystick   = helper.HookJoystick(_guid);
            buttonType = _buttonType;

            timer = new DispatcherTimer()
            {
                Interval = new TimeSpan(20)
            };
            timer.Tick += Timer_Tick;
            timer.Start();
        }
예제 #9
0
        /// <summary>
        /// Instantiates a dialog and passes a generated result
        /// </summary>
        /// <param name="dialogPrefab"></param>
        /// <param name="buttons"></param>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static Dialog Open(GameObject dialogPrefab, ButtonTypeEnum buttons, string title, string message)
        {
            GameObject dialogGameObject = GameObject.Instantiate(dialogPrefab) as GameObject;
            Dialog     dialog           = dialogGameObject.GetComponent <Dialog>();

            DialogResult result = new DialogResult
            {
                Buttons = buttons,
                Title   = title,
                Message = message
            };

            dialog.Launch(result);
            return(dialog);
        }
예제 #10
0
        /// <summary>
        /// Renders the view.
        /// </summary>
        /// <param name="module">The module on behalf of which the view is rendered.</param>
        /// <param name="model">The model being rendered by the view.</param>
        /// <returns>The HTML representing the view.</returns>
        public async Task <string> RenderViewAsync(ModuleDefinition module, object model)
        {
            HtmlBuilder hb = new HtmlBuilder();

            string actionName = (string)HtmlHelper.RouteData.Values["action"];

            string submit = null, submitTT = null; bool submitShown; ButtonTypeEnum submitType = ButtonTypeEnum.Submit; string submitName = null;

            if (ObjectSupport.TryGetPropertyValue <bool>(model, "__submitShown", out submitShown, true) && submitShown)
            {
                ObjectSupport.TryGetPropertyValue <string>(model, "__submitTT", out submitTT);
                ObjectSupport.TryGetPropertyValue <string>(model, "__submit", out submit);
                ObjectSupport.TryGetPropertyValue <ButtonTypeEnum>(model, "__submitType", out submitType, ButtonTypeEnum.Submit);
                ObjectSupport.TryGetPropertyValue <string>(model, "__submitName", out submitName);
            }
            string cancel = null, cancelTT = null; bool cancelShown; ButtonTypeEnum cancelType = ButtonTypeEnum.Cancel;

            if (ObjectSupport.TryGetPropertyValue <bool>(model, "__cancelShown", out cancelShown, true) && cancelShown)
            {
                ObjectSupport.TryGetPropertyValue <string>(model, "__cancelTT", out cancelTT);
                ObjectSupport.TryGetPropertyValue <string>(model, "__cancel", out cancel);
                ObjectSupport.TryGetPropertyValue <ButtonTypeEnum>(model, "__cancelType", out cancelType, ButtonTypeEnum.Cancel);
            }

            List <FormButton> buttons = new List <FormButton>();

            if (submitShown)
            {
                buttons.Add(new FormButton()
                {
                    ButtonType = submitType, Text = submit, Title = submitTT, Name = submitName
                });
            }
            if (cancelShown)
            {
                buttons.Add(new FormButton()
                {
                    ButtonType = cancelType, Text = cancel, Title = cancelTT
                });
            }

            hb.Append($@"
{await RenderBeginFormAsync(ActionName: actionName)}
    {await PartialForm(async () => await RenderPartialViewAsync(module, model))}
    {await FormButtonsAsync(buttons)}
{await RenderEndFormAsync()}");
            return(hb.ToString());
        }
예제 #11
0
        private Button CreateDesktopButton(ColorsConfig colors, int index, ButtonTypeEnum buttonType)
        {
            ButtonConfig btnConf = _config.GetButtonConfigByIndex(index);

            Button button = new Button();

            button.FlatStyle = FlatStyle.Flat;


            button.ForeColor = ColorTranslator.FromHtml(colors.Foreground);
            button.BackColor = ColorTranslator.FromHtml(colors.Background);

            button.Click += (s, e) => ButtonCallback(index);

            button.Height = _config.Application.ApplicationHeight;
            button.Width  = _config.Buttons.MinimumButtonWidth;
            button.Margin = new Padding(_config.Buttons.ButtonMarginSize);


            if (buttonType == ButtonTypeEnum.DisplayGraphic)
            {
                //button.TextAlign = ContentAlignment.TopLeft;
                //button.Text = index.ToString();
                button.Font = new Font(button.Font.FontFamily, (float)(button.Font.SizeInPoints * 0.75));
                button.BackgroundImageLayout = ImageLayout.Center;
            }
            else
            {
                button.FlatAppearance.BorderSize  = _config.Buttons.BorderWidth;
                button.FlatAppearance.BorderColor = ColorTranslator.FromHtml(colors.Border);

                button.Text = btnConf.Name;

                var textwidth = TextRenderer.MeasureText(btnConf.Name, button.Font);
                if (button.Width < (textwidth.Width + (2 * _config.Buttons.ButtonMarginSize)))
                {
                    button.Width = textwidth.Width + (2 * _config.Buttons.ButtonMarginSize);
                }
            }

            return(button);
        }
예제 #12
0
        /// <summary>
        /// Generates a button based on type
        /// Sets button text based on type
        /// </summary>
        /// <param name="buttonType"></param>
        protected virtual GameObject GenerateButton(ButtonTypeEnum buttonType)
        {
            GameObject buttonGo = GameObject.Instantiate(buttonPrefab, buttonParent) as GameObject;
            // Set the text
            CompoundButtonText text = buttonGo.GetComponent <CompoundButtonText>();

            if (text != null)
            {
                text.Text = buttonType.ToString();
            }
            // Add the dialog button component
            SimpleDialogButton simpleDialogButton = buttonGo.GetComponent <SimpleDialogButton>();

            if (simpleDialogButton == null)
            {
                simpleDialogButton = buttonGo.AddComponent <SimpleDialogButton>();
            }
            simpleDialogButton.Type = buttonType;
            return(buttonGo);
        }
예제 #13
0
        public static void HandlePostMediaToThread(string mediaUrl, ButtonTypeEnum mediaType, string caption = null)
        {
            if (MainPageViewModel.CurrentInstance == null)
            {
                return;
            }

            Section section = null;

            switch (mediaType)
            {
            case ButtonTypeEnum.GetImage:
                section = new ImageSection
                {
                    Url     = mediaUrl,
                    Caption = caption
                };
                break;

            case ButtonTypeEnum.GetAudio:
                section = new AudioSection
                {
                    Url     = mediaUrl,
                    Caption = caption
                };
                break;

            case ButtonTypeEnum.GetVideo:
                section = new VideoSection
                {
                    Url = mediaUrl
                };
                break;

            default:
                return;
            }
            MainPageViewModel.CurrentInstance.AddOutgoingSection(section);
        }
예제 #14
0
        public void GetButtonTextAndIconFromType(ButtonTypeEnum type, out string buttonText, out Texture buttonIcon, out int displayOrder)
        {
            switch (type)
            {
            case ButtonTypeEnum.Show:
                buttonText   = "Show";
                buttonIcon   = showIcon;
                displayOrder = 0;
                break;

            case ButtonTypeEnum.Hide:
                buttonText   = "Hide";
                buttonIcon   = hideIcon;
                displayOrder = 1;
                break;

            case ButtonTypeEnum.Adjust:
                buttonText   = "Adjust";
                buttonIcon   = adjustIcon;
                displayOrder = 2;
                break;

            case ButtonTypeEnum.Remove:
                buttonText   = "Remove";
                buttonIcon   = removeIcon;
                displayOrder = 3;
                break;

            case ButtonTypeEnum.Done:
                buttonText   = "Done";
                buttonIcon   = doneIcon;
                displayOrder = 4;
                break;

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
예제 #15
0
 public Button(string id = "", string buttonName = "", string buttonText = "", EmotionEnum emotion = EmotionEnum.Cool, ButtonTypeEnum buttonType = ButtonTypeEnum.None, string nextNodeId = "", bool defaultButton = false, bool hidden = false, string variableValue = "")
 {
     this._id           = id;
     this.ButtonName    = buttonName;
     this.ButtonText    = buttonText;
     this.Emotion       = emotion;
     this.ButtonType    = buttonType;
     this.NextNodeId    = nextNodeId;
     this.DefaultButton = defaultButton;
     this.Hidden        = hidden;
     this.VariableValue = variableValue;
 }
예제 #16
0
        /// <summary>
        /// 按鈕建立
        /// </summary>
        /// <param name="buttonSetting">按鈕設定檔</param>
        public void AccordionLoad(AccordionControl accordionControl1, ButtonSetting buttonSetting)
        {
            AccordionControl = accordionControl1;
            accordionControl1.Clear();
            accordionControl1.AllowItemSelection = true;
            if (buttonSetting != null)
            {
                foreach (var item in buttonSetting.ButtonGroupSettings)
                {
                    ButtonTypeEnum ButtonTypeEnum = (ButtonTypeEnum)item.ButtonStyle;
                    switch (ButtonTypeEnum)
                    {
                    case ButtonTypeEnum.Group:     // 群組
                    {
                        //
                        //列表
                        //
                        AccordionControlElement[] ButtonItem = new AccordionControlElement[item.ButtonItemSettings.Count];        //建立列表
                        for (int i = 0; i < item.ButtonItemSettings.Count; i++)
                        {
                            ButtonItem[i] = new AccordionControlElement()
                            {
                                Style = ElementStyle.Item,                   //設定列表類型
                                Name  = item.ButtonItemSettings[i].ItemName, // 設定顯示名稱
                                Tag   = item.ButtonItemSettings[i],          //自訂TAG
                                Text  = item.ButtonItemSettings[i].ItemName, //縮小名稱
                            };
                            AccordionControlElements.Add(ButtonItem[i]);
                        }
                        //
                        // 群組
                        //
                        AccordionControlElement Group = new AccordionControlElement(); //建立群組
                        Group.Expanded = false;                                        //不顯示列表
                        Group.Name     = item.GroupName;                               // 設定顯示名稱
                        Group.Text     = item.GroupName;                               //縮小名稱
                                                                                       //Group.ImageOptions.Image= System.Drawing.Bitmap//加入ICON
                        /*設定字體*/
                        Group.Appearance.Normal.FontStyleDelta  = FontStyle.Bold;
                        Group.Appearance.Normal.Name            = "微軟正黑體";
                        Group.Appearance.Normal.FontSizeDelta   = 10;
                        Group.Appearance.Hovered.FontStyleDelta = FontStyle.Bold;
                        Group.Appearance.Hovered.Name           = "微軟正黑體";
                        Group.Appearance.Hovered.FontSizeDelta  = 10;
                        Group.Appearance.Pressed.FontStyleDelta = FontStyle.Bold;
                        Group.Appearance.Pressed.Name           = "微軟正黑體";
                        Group.Appearance.Pressed.FontSizeDelta  = 10;
                        Group.Elements.AddRange(ButtonItem);        //將列表加入至群組
                        accordionControl1.Elements.Add(Group);      //將群組加入至控制物件
                                                                    //
                                                                    //列表
                                                                    //
                        for (int i = 0; i < item.ButtonItemSettings.Count; i++)
                        {
                            /*設定字體*/
                            ButtonItem[i].Appearance.Normal.FontStyleDelta  = FontStyle.Bold;
                            ButtonItem[i].Appearance.Normal.Name            = "微軟正黑體";
                            ButtonItem[i].Appearance.Normal.FontSizeDelta   = 8;
                            ButtonItem[i].Appearance.Hovered.FontStyleDelta = FontStyle.Bold;
                            ButtonItem[i].Appearance.Hovered.Name           = "微軟正黑體";
                            ButtonItem[i].Appearance.Hovered.FontSizeDelta  = 8;
                            ButtonItem[i].Appearance.Pressed.FontStyleDelta = FontStyle.Bold;
                            ButtonItem[i].Appearance.Pressed.Name           = "微軟正黑體";
                            ButtonItem[i].Appearance.Pressed.FontSizeDelta  = 8;
                        }
                    }
                    break;

                    case ButtonTypeEnum.Item:     //列表
                    {
                        AccordionControlElement ButtonItem = new AccordionControlElement()
                        {
                            Style = ElementStyle.Item,
                            Name  = item.ButtonItemSettings[0].ItemName,
                            Tag   = item.ButtonItemSettings[0],
                            Text  = item.ButtonItemSettings[0].ItemName,
                        };
                        ButtonItem.Appearance.Normal.FontStyleDelta  = FontStyle.Bold;
                        ButtonItem.Appearance.Normal.Name            = "微軟正黑體";
                        ButtonItem.Appearance.Normal.FontSizeDelta   = 8;
                        ButtonItem.Appearance.Hovered.FontStyleDelta = FontStyle.Bold;
                        ButtonItem.Appearance.Hovered.Name           = "微軟正黑體";
                        ButtonItem.Appearance.Hovered.FontSizeDelta  = 8;
                        ButtonItem.Appearance.Pressed.FontStyleDelta = FontStyle.Bold;
                        ButtonItem.Appearance.Pressed.Name           = "微軟正黑體";
                        ButtonItem.Appearance.Pressed.FontSizeDelta  = 8;
                        accordionControl1.Elements.Add(ButtonItem);
                        AccordionControlElements.Add(ButtonItem);
                    }
                    break;
                    }
                }
                accordionControl1.OptionsMinimizing.AllowMinimizeMode = DevExpress.Utils.DefaultBoolean.False;         // 鎖定視窗
                accordionControl1.ElementClick   += new ElementClickEventHandler(this.accordionControl1_ElementClick); //按鈕事件
                accordionControl1.SelectedElement = AccordionControlElements[0];                                       //觸發初始按鈕
            }
        }
예제 #17
0
        /// <summary>
        /// Generates a template for a default button based on type
        /// </summary>
        /// <param name="type"></param>
        /// <param name="numCustomButtons"></param>
        /// <param name="useHide"></param>
        /// <param name="useAdjust"></param>
        /// <returns></returns>
        private static ButtonTemplate GetDefaultButtonTemplateFromType(ButtonTypeEnum type, int numCustomButtons, bool useHide, bool useAdjust)
        {
            // Button position is based on custom buttons
            // In the app bar, Hide/Show
            switch (type)
            {
            case ButtonTypeEnum.Custom:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Custom,
                           "Custom",
                           "",
                           "Custom",
                           0,
                           0));

            case ButtonTypeEnum.Adjust:
                int adjustPosition = numCustomButtons + 1;

                if (!useHide)
                {
                    adjustPosition--;
                }

                return(new ButtonTemplate(
                           ButtonTypeEnum.Adjust,
                           "Adjust",
                           "AppBarAdjust",
                           "Adjust",
                           adjustPosition, // Always next-to-last to appear
                           0));

            case ButtonTypeEnum.Done:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Done,
                           "Done",
                           "AppBarDone",
                           "Done",
                           0,
                           0));

            case ButtonTypeEnum.Hide:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Hide,
                           "Hide",
                           "AppBarHide",
                           "Hide Menu",
                           0, // Always the first to appear
                           0));

            case ButtonTypeEnum.Remove:
                int removePosition = numCustomButtons + 1;
                if (useAdjust)
                {
                    removePosition++;
                }

                if (!useHide)
                {
                    removePosition--;
                }

                return(new ButtonTemplate(
                           ButtonTypeEnum.Remove,
                           "Remove",
                           "KeyboardKeyGlyphs_Close",
                           "Remove",
                           removePosition, // Always the last to appear
                           1));

            case ButtonTypeEnum.Show:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Show,
                           "Show",
                           "AppBarShow",
                           "Show Menu",
                           0,
                           0));

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
예제 #18
0
        private bool GetButtonVisible(ButtonTypeEnum buttonType)
        {
            // Set visibility based on button type / options
            switch (buttonType)
            {
            default:
                break;

            case ButtonTypeEnum.Remove:
                if (!useRemove)
                {
                    return(false);
                }
                break;

            case ButtonTypeEnum.Hide:
                if (!useHide)
                {
                    return(false);
                }
                break;

            case ButtonTypeEnum.Adjust:
                if (!useAdjust)
                {
                    return(false);
                }
                break;
            }

            switch (state)
            {
            case AppBarStateEnum.Default:
            default:
                switch (buttonType)
                {
                // Show hide, adjust, remove buttons
                // The rest are hidden
                case AppBar.ButtonTypeEnum.Hide:
                case AppBar.ButtonTypeEnum.Remove:
                case AppBar.ButtonTypeEnum.Adjust:
                case AppBar.ButtonTypeEnum.Custom:
                    return(true);

                default:
                    return(false);
                }

            case AppBarStateEnum.Hidden:
                switch (buttonType)
                {
                // Show show button
                // The rest are hidden
                case ButtonTypeEnum.Show:
                    return(true);

                default:
                    return(false);
                }

            case AppBarStateEnum.Manipulation:
                switch (buttonType)
                {
                // Show done button
                // The rest are hidden
                case AppBar.ButtonTypeEnum.Done:
                    return(true);

                default:
                    return(false);
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Generates a template for a default button based on type
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private static ButtonTemplate GetDefaultButtonTemplateFromType(ButtonTypeEnum type, int numCustomButtons, bool useHide, bool useAdjust, bool useRemove)
        {
            // Button position is based on custom buttons
            // In the app bar, Hide/Show
            switch (type)
            {
            default:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Custom,
                           "Custom",
                           "",
                           "Custom",
                           0,
                           0));

            case ButtonTypeEnum.Adjust:
                int adjustPosition = numCustomButtons + 1;
                if (!useHide)
                {
                    adjustPosition--;
                }
                return(new ButtonTemplate(
                           ButtonTypeEnum.Adjust,
                           "Adjust",
                           "EBD2",
                           "Adjust",
                           adjustPosition, // Always next-to-last to appear
                           0));

            case ButtonTypeEnum.Done:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Done,
                           "Done",
                           "E8FB",
                           "Done",
                           0,   //-2,
                           0)); //-1);

            case ButtonTypeEnum.Hide:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Hide,
                           "Hide",
                           "E76C",
                           "Hide Menu",
                           0,// Always the first to appear
                           0));

            case ButtonTypeEnum.Remove:
                int removePosition = numCustomButtons + 1;
                if (useAdjust)
                {
                    removePosition++;
                }
                if (!useHide)
                {
                    removePosition--;
                }
                return(new ButtonTemplate(
                           ButtonTypeEnum.Remove,
                           "Remove",
                           "EC90",
                           "Remove",
                           removePosition, // Always the last to appear
                           1));

            case ButtonTypeEnum.Show:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Show,
                           "Show",
                           "E700",
                           //"EC90",
                           "Show Menu",
                           0,//-2,
                           0));
            }
        }
예제 #20
0
        public QCButtonMsg(byte[] data, uint len)
            : base(CmdIDType.GET_QC_DATA, data, len)
        {
            // Lot Code
            QCInfo.LotCode = GetString(0, 6);

            // button type
            ButtonTypeEnum buttonType = (ButtonTypeEnum)GetDWord();

            // Expiration Date
            // skip time
            Skip(12);

            int Month = (int)GetDWord();
            int Day   = (int)GetDWord();
            int Year  = (int)GetDWord();

            QCInfo.Expiration = new DateTime(Year, Month, Day);

            // skip PM Flag
            Skip(4);

            // Measure Time
            QCInfo.MeasureTime = GetWord();

            ////////////////////////////////////////
            // Channel 1
            // Level 1 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan1Level1        = new QCRanges();
            QCInfo.Chan1Level1.Target = ((float)GetWord()) / 10;
            QCInfo.Chan1Level1.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel1.Add(QCInfo.Chan1Level1);

            // Level 2 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan1Level2        = new QCRanges();
            QCInfo.Chan1Level2.Target = ((float)GetWord()) / 10;
            QCInfo.Chan1Level2.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel2.Add(QCInfo.Chan1Level2);

            // Level 3 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan1Level3        = new QCRanges();
            QCInfo.Chan1Level3.Target = ((float)GetWord()) / 10;
            QCInfo.Chan1Level3.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel3.Add(QCInfo.Chan1Level3);

            ////////////////////////////////////////
            // Channel 2
            // Level 1 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan2Level1        = new QCRanges();
            QCInfo.Chan2Level1.Target = ((float)GetWord()) / 10;
            QCInfo.Chan2Level1.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel1.Add(QCInfo.Chan2Level1);

            // Level 2 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan2Level2        = new QCRanges();
            QCInfo.Chan2Level2.Target = ((float)GetWord()) / 10;
            QCInfo.Chan2Level2.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel2.Add(QCInfo.Chan2Level2);

            // Level 3 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan2Level3        = new QCRanges();
            QCInfo.Chan2Level3.Target = ((float)GetWord()) / 10;
            QCInfo.Chan2Level3.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel3.Add(QCInfo.Chan2Level3);

            ////////////////////////////////////////
            // Channel 3
            // Level 1 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan3Level1        = new QCRanges();
            QCInfo.Chan3Level1.Target = ((float)GetWord()) / 10;
            QCInfo.Chan3Level1.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel1.Add(QCInfo.Chan3Level1);

            // Level 2 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan3Level2        = new QCRanges();
            QCInfo.Chan3Level2.Target = ((float)GetWord()) / 10;
            QCInfo.Chan3Level2.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel2.Add(QCInfo.Chan3Level2);

            // Level 3 TargetValue
            // Skip level
            Skip(4);
            QCInfo.Chan3Level3        = new QCRanges();
            QCInfo.Chan3Level3.Target = ((float)GetWord()) / 10;
            QCInfo.Chan3Level3.Range  = ((float)GetWord()) / 10;
            QCInfo.QCLevel3.Add(QCInfo.Chan3Level3);

            // Measurable Ranges
            QCInfo.Chan1Ranges            = new Range(0, 0);
            QCInfo.Chan1Ranges.LowerLimit = ((float)GetWord()) / 10;
            QCInfo.Chan1Ranges.UpperLimit = ((float)GetWord()) / 10;

            QCInfo.Chan2Ranges            = new Range(0, 0);
            QCInfo.Chan2Ranges.LowerLimit = ((float)GetWord()) / 10;
            QCInfo.Chan2Ranges.UpperLimit = ((float)GetWord()) / 10;

            QCInfo.Chan3Ranges            = new Range(0, 0);
            QCInfo.Chan3Ranges.LowerLimit = ((float)GetWord()) / 10;
            QCInfo.Chan3Ranges.UpperLimit = ((float)GetWord()) / 10;

            Skip(2);    // skip Out Of Vial Time
            Skip(4);    // Skip Sent Flag

            QCInfo.SensorID       = (SensorIDEnum)GetWord();
            QCInfo.LotCRC         = (ushort)GetWord();
            QCInfo.timestamp      = GetDWord();
            QCInfo.timeOffsetMins = GetWord();

            short crc = GetWord();
        }
예제 #21
0
        /// <summary>
        /// Generates a template for a default button based on type
        /// </summary>
        /// <param name="type"></param>
        /// <param name="numCustomButtons"></param>
        /// <param name="useHide"></param>
        /// <param name="useAdjust"></param>
        /// <returns></returns>
        private static ButtonTemplate GetDefaultButtonTemplateFromType(ButtonTypeEnum type, int numCustomButtons, bool useHide, bool useAdjust)
        {
            // Button position is based on custom buttons
            // In the app bar, Hide/Show
            switch (type)
            {
            case ButtonTypeEnum.Custom:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Custom,
                           "Custom",
                           "",
                           "Custom",
                           0,
                           0));

            case ButtonTypeEnum.Adjust:
                int adjustPosition = numCustomButtons + 1;

                if (!useHide)
                {
                    adjustPosition--;
                }

                return(new ButtonTemplate(
                           ButtonTypeEnum.Adjust,
                           "Adjust",
                           "ObjectCollectionScatter", // Replace with your custom icon texture name in HolographicButton prefab
                           "Adjust",
                           adjustPosition,            // Always next-to-last to appear
                           0));

            case ButtonTypeEnum.Done:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Done,
                           "Done",
                           "ObjectCollectionScatter", // Replace with your custom icon texture name in HolographicButton prefab
                           "Done",
                           0,
                           0));

            case ButtonTypeEnum.Hide:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Hide,
                           "Hide",
                           "ObjectCollectionScatter", // Replace with your custom icon texture name in HolographicButton prefab
                           "Hide Menu",
                           0,                         // Always the first to appear
                           0));

            case ButtonTypeEnum.Remove:
                int removePosition = numCustomButtons + 1;
                if (useAdjust)
                {
                    removePosition++;
                }

                if (!useHide)
                {
                    removePosition--;
                }

                return(new ButtonTemplate(
                           ButtonTypeEnum.Remove,
                           "Remove",
                           "ObjectCollectionScatter", // Replace with your custom icon texture name in HolographicButton prefab
                           "Remove",
                           removePosition,            // Always the last to appear
                           1));

            case ButtonTypeEnum.Show:
                return(new ButtonTemplate(
                           ButtonTypeEnum.Show,
                           "Show",
                           "ObjectCollectionScatter", // Replace with your custom icon texture name in HolographicButton prefab
                           "Show Menu",
                           0,
                           0));

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
 public EditableListButton(String caption, String script, ButtonTypeEnum buttonType)
 {
     this.caption    = caption;
     this.script     = script;
     this.buttonType = buttonType;
 }