コード例 #1
0
        private void updateStatus(SetupOption option, SetupStatus status, string message)
        {
            DataGridViewRow row = dataGridView.Rows[option.StatusIndex];

            switch (status)
            {
            case SetupStatus.InProgress:
                row.Cells[0].Value = Resources.InProgress;
                row.Cells[2].Value = "In Progress";
                row.Cells[3].Value = message;
                break;

            case SetupStatus.Success:
                row.Cells[0].Value = Resources.Success;
                row.Cells[2].Value = "Success";
                row.Cells[3].Value = message;
                break;

            case SetupStatus.Failure:
                row.Cells[0].Value = Resources.Failure;
                row.Cells[2].Value = "Failed";
                row.Cells[3].Value = message;
                break;
            }
        }
コード例 #2
0
        private void processOption(SetupOption option)
        {
            updateStatus(option, SetupStatus.InProgress);

            if (option.ProcessOption(new UpdateStatusDelegate(updateStatus)))
            {
                // Once all steps complete, mark success.
                updateStatus(option, SetupStatus.Success);
            }
        }
コード例 #3
0
        public TerrariaSetupOptionButton(SetupOption option)
        {
            InitializeComponent();
            this.option  = option;
            tooltip.Text = option.Tooltip;
            BitmapSource bitmap = Setup.GetOptionIcon(option.Icon);

            image.Source = bitmap;
            image.Width  = Math.Min(28, bitmap.PixelWidth);
            image.Height = Math.Min(28, bitmap.PixelHeight);
        }
コード例 #4
0
        public void Update()
        {
            SetupOption option = new SetupOption("", "", navigate);

            labelName.Content = folder.Name;

            BitmapSource bitmap = folder.LoadIcon();

            imageIcon.Source = bitmap;
            imageIcon.Width  = Math.Min(68, bitmap.PixelWidth);
            imageIcon.Height = Math.Min(68, bitmap.PixelHeight);
        }
コード例 #5
0
        public TerrariaSetupFolder(SetupFolder folder, bool isParent, Action navigate)
        {
            InitializeComponent();

            folder.Entry  = this;
            this.navigate = navigate;
            this.folder   = folder;
            SetupOption option = new SetupOption("", "", navigate);

            if (isParent)
            {
                option.Tooltip       = "Go back to the parent folder";
                option.Icon          = "FolderLeave";
                labelName.Content    = "Go Back";
                labelEntries.Content = "Parent: " + folder.Name;
            }
            else
            {
                option.Tooltip       = "Open the subfolder";
                option.Icon          = "FolderEnter";
                labelName.Content    = folder.Name;
                labelEntries.Content = "Folder: " + folder.Entries.Count + " Entries";

                TerrariaSetupOptionButton button2 = new TerrariaSetupOptionButton(option);
                stackPanelOptions.Children.Add(button2);

                option = new SetupOption("Edit Folder", "Gear", folder.EditFolder);
            }

            TerrariaSetupOptionButton button = new TerrariaSetupOptionButton(option);

            stackPanelOptions.Children.Add(button);

            BitmapSource bitmap = folder.LoadIcon();

            imageIcon.Source = bitmap;
            imageIcon.Width  = Math.Min(68, bitmap.PixelWidth);
            imageIcon.Height = Math.Min(68, bitmap.PixelHeight);
        }
コード例 #6
0
ファイル: MenuOption.cs プロジェクト: tokyo0709/Red7Console
 public SetupMenuOption(SetupOption option, bool active)
 {
     Option = option;
     Active = active;
 }
コード例 #7
0
 private void updateStatus(SetupOption option, SetupStatus status)
 {
     updateStatus(option, status, null);
 }
コード例 #8
0
        public static ServiceMsgListener ShowSetupOptionDialog(ServiceMsgListener cb, Activity act,
                                                               SetupOption setupOption)
        {
            bool answered = false;

            var dia = new Dialog(act);

            dia.SetContentView(Resource.Layout.dialog_setup_option);

            var rgMain  = dia.FindViewById <RadioGroup>(Resource.Id.rgMain);
            var tvTitle = dia.FindViewById <TextView>(Resource.Id.tvTitle);

            tvTitle.Text       = setupOption.Title;
            rgMain.Orientation = Orientation.Vertical;

            cb = delegate(string msg)
            {
                var res = ISCPHelper.Parse(msg);
                if (res[0] == setupOption.Cmd)
                {
                    answered = true;
                    if (res[1] == "N/A")
                    {
                        Toast.MakeText(Application.Context, "Receiver has answered with N/A", ToastLength.Short).Show();
                        return;
                    }
                    int c = 0;
                    foreach (var entry in setupOption.LiEntries)
                    {
                        if (res[1] == entry.Cmd)
                        {
                            ((RadioButton)rgMain.GetChildAt(c)).Checked = true;
                            break;
                        }
                        c++;
                    }
                }
            };

            int i = 0;

            foreach (var entry in setupOption.LiEntries)
            {
                var rgItem = (RadioButton)LayoutInflater.From(act)
                             .Inflate(Resource.Layout.item_setup_entry, rgMain, false);
                rgItem.Text   = entry.Title;
                rgItem.Tag    = i;
                rgItem.Click += delegate
                {
                    int indSel = Convert.ToInt32(rgItem.Tag);
                    var ent    = setupOption.LiEntries[indSel];
                    DeviceService.SendCommand($"{setupOption.Cmd}{ent.Cmd}");
                };

                rgMain.AddView(rgItem);
                i++;
            }

            dia.Show();

            rgMain.PostDelayed(() =>
            {
                if (!answered)
                {
                    Toast.MakeText(act, $"Your model may not support this feature", ToastLength.Long).Show();
                }
            }, 500);

            if (DeviceService.CmdPowerStatus?.PowerState == false)
            {
                Toast.MakeText(act, $"Your receiver is turned off and may not responding", ToastLength.Long).Show();
            }
            return(cb);
        }