Пример #1
0
 private void AddCommandToList(DialogCommand c)
 {
     if (!RequestedDialogCommands.Contains(c))
     {
         RequestedDialogCommands.Add(c);
     }
 }
Пример #2
0
        private void ButResultDir_Click(object sender, EventArgs e)
        {
            var d = new DialogCommand(DialogType.OpenDir)
            {
                DialogTitle = "Каталог сформированных отчетов"
            };

            ResultDir.Text = d.Run(ResultDir.Text);
        }
        public static IEnumerable <DialogCommand> GetCommands(this DialogButtons dialogButtons)
        {
            var okCommand = new DialogCommand {
                Text = "_OK", Result = MessageBoxResult.OK
            };
            var cancelCommand = new DialogCommand {
                Text = "_Cancel", Result = MessageBoxResult.Cancel, IsDefault = true
            };
            var noCommand = new DialogCommand {
                Text = "_No", Result = MessageBoxResult.No
            };
            var yesCommand = new DialogCommand {
                Text = "_Yes", Result = MessageBoxResult.Yes
            };

            switch (dialogButtons)
            {
            case DialogButtons.Ok:
                okCommand.IsDefault = true;
                yield return(okCommand);

                break;

            case DialogButtons.OkCancel:
                yield return(okCommand);

                yield return(cancelCommand);

                break;

            case DialogButtons.YesNoCancel:
                yield return(yesCommand);

                yield return(noCommand);

                yield return(cancelCommand);

                break;

            case DialogButtons.YesNo:
                noCommand.IsDefault = true;
                yield return(yesCommand);

                yield return(noCommand);

                break;

            case DialogButtons.None:
                break;

            case DialogButtons.Custom:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(dialogButtons), dialogButtons, null);
            }
        }
Пример #4
0
        private void ButResultFile_Click(object sender, EventArgs e)
        {
            var d = new DialogCommand(DialogType.OpenExcel)
            {
                DialogTitle = "Файл для добавления сформированных отчетов"
            };

            ResultFile.Text = d.Run(ResultFile.Text);
        }
Пример #5
0
        public void EditConnString()
        {
            var vm     = new ConnectionStringEditorViewModel(Value);
            var result = DialogCommand.ShowDialog(vm);

            if (result == true)
            {
                Value = vm.ConnectionString;
            }
        }
Пример #6
0
        private void ButExport_Click(object sender, EventArgs e)
        {
            if (Template.Text.IsEmpty())
            {
                Different.MessageError("Не указано имя шаблона");
                return;
            }
            SaveTemplate();
            var f = new DialogCommand(DialogType.OpenExcel)
            {
                DialogTitle  = "Файл отчета для экспорта шаблона",
                ErrorMessage = "Указан недопустимый файл отчета"
            }.Run();

            try
            {
                if (!f.IsEmpty())
                {
                    var        t     = _book.SysPage.GetTemplate(Template.Text);
                    var        p     = _book.SysPage.GerTemplateGeneralProps(Template.Text);
                    Workbook   rbook = null;
                    ReportBook book  = null;
                    bool       notb  = true;
                    foreach (var b in GeneralRep.Books.Values)
                    {
                        try
                        {
                            if (b.Workbook.FullName == f)
                            {
                                notb  = false;
                                book  = b;
                                rbook = b.Workbook;
                            }
                        }
                        catch { }
                    }
                    if (notb)
                    {
                        rbook = GeneralRep.Application.Workbooks.Open(f);
                        book  = GeneralRep.ActiveBook;
                    }
                    if (book.SysPage.TemplateX(Template.Text) == -1 || Different.MessageQuestion("В отчете " + book.Code + " уже есть шаблон " + Template.Text + ". Заменить?"))
                    {
                        book.SysPage.PutTemplate(Template.Text, p.ToPropertyString(), t);
                        rbook.Save();
                    }
                    if (notb)
                    {
                        rbook.Close();
                    }
                }
            }
            catch { Different.MessageError("Ошибка при экспорте шаблона в файл " + f); }
        }
Пример #7
0
 public DialogEntry(byte npc, byte type, int message, byte cnd, int cndData01, int cndData02, byte cmd, int cmdData01, int cmdData02)
 {
     Npc             = npc;
     Message         = message;
     Type            = (DialogType)type;
     CommandData01   = cmdData01;
     CommandData02   = cmdData02;
     ConditionData01 = cndData01;
     ConditionData02 = cndData02;
     Command         = (DialogCommand)cmd;
     Condition       = (DialogCondition)cnd;
 }
    //private DialogCommand dialogCommand;

    public IEnumerator EnterDialog(DialogCommand dialogCommand)
    {
        DialogUI.SetActive(true);
        hidenUI.SetActive(false);
        GameObject.Find("Player").GetComponent <PlayerControl>().CommandPlayerIdle();
        yield return(0);

        yield return(StartCoroutine(enterDialog(dialogCommand)));

        DialogUI.SetActive(false);
        hidenUI.SetActive(true);
        yield return(0);
    }
Пример #9
0
        private async Task OnExecuteWithDialogOptionActionAsync(IDialogOption dialogOption)
        {
            if (DialogCommand is not null)
            {
                Log.Info("User pressed dialog option, executing command");

                // Not everyone is using the ICatelCommand, make sure to check if execution is allowed
                if (DialogCommand.CanExecute(dialogOption))
                {
                    DialogCommand.Execute(dialogOption);
                }
            }
        }
Пример #10
0
        public InputHandler()
        {
            _buttonShoot = Keyboard.Key.Space;
            buttonShoot = new ShootCommand();
            _buttonLeft = Keyboard.Key.A;
            _buttonRight = Keyboard.Key.D;
            _buttonUp = Keyboard.Key.W;
            _buttonDown = Keyboard.Key.S;
            _buttonBigShoot = Keyboard.Key.LAlt;
            _buttonSelect = Keyboard.Key.Return;
            _mouseShoot = Mouse.Button.Left;
            _mouseBigShoot = Mouse.Button.Right;
            _P = Keyboard.Key.P;
            _R = Keyboard.Key.R;
            _ArrowUp = Keyboard.Key.Up;
            _ESC = Keyboard.Key.Escape;

            nrShoot = 11;
            nrSelect = 14;
            nrBigShoot = 10;

            turnCommand = new TurnCommand();
            moveCommandArray = new Command[4];
            for(int i = 0; i < moveCommandArray.Length; i++)
            {
                moveCommandArray[i] = new MoveCommand();
            }

            menuUpCommand = new MenuUpCommand();
            menuDownCommand = new MenuDownCommand();
            menuSelectCommand = new MenuSelectCommand();
            turnCommandJoystick = new TurnCommandJoystick();

            PausePressedCommand = new PausePressedCommand();
            ResumePressedCommand = new ResumePressedCommand();

            UpgradePressedCommand = new UpgradePressedCommand();
            ESCPressedCommand = new ESCPressedCommand();
            dialogEnterCommand = new DialogEnterCommand();

            RequestedCommands = new List<Command>();
            RequestedMenuCommands = new List<MenuCommand>();
            RequestedDialogCommands = new List<DialogCommand>();
            requestedPauseCommands = new List<PauseCommand>();
            RequestedGameCommands = new List<GameCommand>();
            ConfigureJoystick(0);

            mousePosition = Mouse.GetPosition();
        }
Пример #11
0
        private void Reports_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                //Файл бланка отчета
                int ind      = e.RowIndex;
                var isNewRow = Reports.Rows[ind].IsNewRow;
                if (e.ColumnIndex == 3)
                {
                    var d = new DialogCommand(DialogType.OpenExcel);
                    d.DialogTitle  = "Файл шаблона отчета";
                    d.ErrorMessage = "Указан недопустимый файл бланка отчета";
                    string file = d.Run(Reports.Rows[ind].Get("ReportFile"));
                    try
                    {
                        Workbook wbook = GeneralRep.Application.Workbooks.Open(file);
                        var      sys   = new SysPage(wbook);
                        string   code  = sys.GetValue("Report");
                        string   name  = sys.GetValue("ReportName");
                        if (isNewRow)
                        {
                            if (file.IsEmpty())
                            {
                                return;
                            }
                            ind = Reports.Rows.Add();
                        }
                        var cells = Reports.Rows[ind].Cells;
                        cells["ReportFile"].Value = file;
                        cells["Report"].Value     = code;
                        cells["ReportName"].Value = name;

                        var tag = cells.Get("ReportTag").IsEmpty() ? new Dictionary <string, string>() : cells.Get("ReportTag").ToPropertyDictionary();
                        AddPropToTag(tag, sys, "SaveToArchive");
                        AddPropToTag(tag, sys, "DayLength");
                        AddPropToTag(tag, sys, "HourLength");
                        AddPropToTag(tag, sys, "MinuteLength");
                        cells["ReportTag"].Value = tag.ToPropertyString();
                        wbook.Save();
                        wbook.Close();
                        Reports.Rows[ind].Selected = true;
                    }
                    catch { Different.MessageError("Указан недопустимый файл бланка отчета"); }
                }
            }
            catch { }
            ChangeReportsRow();
        }
    public void ReadStoryFormFile()
    {
        Command     command = new Command();
        XmlDocument xmlDoc  = new XmlDocument();

        xmlDoc.LoadXml(story.text);
        XmlNodeList storyElementList = xmlDoc.SelectSingleNode("/Story").ChildNodes;

        foreach (XmlNode _storyElement in storyElementList)
        {
            StoryElement storyElement      = new StoryElement();
            XmlNode      conditionListNode = _storyElement.SelectSingleNode("ConditionList");
            XmlNode      TaskNode          = _storyElement.SelectSingleNode("Task");
            XmlNode      dialogListNode    = _storyElement.SelectSingleNode("DialogList");
            XmlNode      npcActionListNode = _storyElement.SelectSingleNode("NpcActionList");

            if (conditionListNode != null)
            {
                List <Condition> ConditionList;
                ConditionList = ReadConditionList(conditionListNode);
                ConditionCommand conditionCommand = new ConditionCommand(ConditionList);
                storyElement.commandList.Add(conditionCommand);
            }
            if (dialogListNode != null)
            {
                List <Dialog> DialogList;
                DialogList = ReadDialogList(dialogListNode);
                DialogCommand dialogCommand = new DialogCommand(DialogList);
                storyElement.commandList.Add(dialogCommand);
            }
            if (npcActionListNode != null)
            {
                List <NpcAction> NpcActionList;
                NpcActionList = ReadNpcActionList(npcActionListNode);
                NpcActionCommand npcActionCommand = new NpcActionCommand(NpcActionList);
                storyElement.commandList.Add(npcActionCommand);
            }
            if (TaskNode != null)
            {
                Task task;
                task = ReadTask(TaskNode);
                TaskCommand taskCommand = new TaskCommand(task);
                storyElement.commandList.Add(taskCommand);
            }
            storyList.Add(storyElement);
        }
    }
Пример #13
0
        public void Encrypt()
        {
            var computerNames = Parent.ParameterViewModels.Where(p => p.Editor == EditorOptions.ComputerName)
                                .Select(p => p.Value)
                                .Where(v => !v.IsNullOrEmpty())
                                .Distinct()
                                .ToList();
            var vm     = new EncryptionViewModel(Value, computerNames);
            var result = DialogCommand.ShowDialog(vm);

            if (result == true)
            {
                Value = vm.EncryptedValue;
                Parameter.Encrypted = EncryptionOptions.Yes;
                RefreshEncryption();
            }
        }
    private IEnumerator enterDialog(DialogCommand dialogCommand)
    {
        for (int i = 0; i < dialogCommand.dialogList.Count; i++)
        {
            DialogUI.transform.FindChild("bgSprite/headSprite").GetComponent <UISprite>().spriteName = dialogCommand.dialogList[i].spriteName;
            DialogUI.transform.FindChild("bgSprite/dialogLabel").GetComponent <UILabel>().text       = dialogCommand.dialogList[i].dialog;
            while (!IsClick)
            {
                yield return(0);

                if (Input.GetKeyDown(KeyCode.A))
                {
                    IsClick = true;
                }
            }
            if (IsClick)
            {
                IsClick = false;
            }
        }
    }
Пример #15
0
 private void Projects_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try //Нажатие кнопки обзор
     {
         if (e.ColumnIndex == 5 && e.RowIndex >= 0)
         {
             try
             {
                 string t        = "Файл проекта ";
                 var    isNewRow = Projects.Rows[e.RowIndex].IsNewRow;
                 try { if (!isNewRow)
                       {
                           t += Projects.Rows[e.RowIndex].Get("Project");
                       }
                 }
                 catch { }
                 var d = new DialogCommand(DialogType.OpenFile)
                 {
                     DialogTitle = t, ErrorMessage = "Указан недопустимый файл проекта"
                 };
                 d.FileTables = new[] { "CalcParams", "CalcSubParams", "GraficsList", "SignalsInUse", "Providers" };
                 string file = d.Run(Projects.Rows[e.RowIndex].Get("ProjectFile"));
                 if (file.IsEmpty())
                 {
                     return;
                 }
                 if (isNewRow)
                 {
                     Projects.Rows.Add();
                 }
                 var cells = Projects.Rows[e.RowIndex].Cells;
                 cells["ProjectFile"].Value = file;
                 cells["Project"]           = new DataGridViewTextBoxCell();
                 using (var syst = new SysTabl(file))
                 {
                     string s = syst.SubValue("ProjectInfo", "Project");
                     if (s != null)
                     {
                         cells["Project"].Value = s;
                     }
                     else
                     {
                         cells["Project"].Value = DBNull.Value;
                     }
                     s = syst.SubValue("ProjectInfo", "ProjectName");
                     if (s != null)
                     {
                         cells["ProjectName"].Value = s;
                     }
                     else
                     {
                         cells["ProjectName"].Value = DBNull.Value;
                     }
                 }
                 UpdateProvidersList();
             }
             catch (Exception ex)
             {
                 GeneralRep.ShowError("Указан недопустимый файл проекта", ex);
             }
         }
     }
     catch {}
 }
Пример #16
0
        public void DashDialog(string context)
        {
            IHalationCommand cmd = new DialogCommand(Halation.CurrentSelectedLine, this.GetIndent(Halation.CurrentSelectedLine), Halation.currentCodePackage, context);

            HalationInvoker.Dash(Halation.currentScriptName, cmd);
        }
Пример #17
0
        public MainPageViewModel(MyIndicatorView myIndicatorView)
        {
            VAligns.Add(LayoutAlignment.Start);
            VAligns.Add(LayoutAlignment.Center);
            VAligns.Add(LayoutAlignment.End);

            HAligns.Add(LayoutAlignment.Start);
            HAligns.Add(LayoutAlignment.Center);
            HAligns.Add(LayoutAlignment.End);

            VAlign.Value = VAligns[1];
            HAlign.Value = HAligns[1];

            Configurations.LoadingConfig = new LoadingConfig {
                DefaultMessage = "Loading...", IsReusable = true
            };

            var loadingFlg = false;

            LoadingCommand.Subscribe(async _ =>
            {
                //Loading.Instance.Show();
                //await Task.Delay(1);
                //Loading.Instance.Hide();

                await Loading.Instance.StartAsync(async progress => {
                    //await Task.Delay(1);
                    progress.Report(0d);
                    for (var i = 0; i < 100; i++)
                    {
                        if (i == 50)
                        {
                            Loading.Instance.SetMessage("Soon...");
                        }
                        await Task.Delay(25);
                        progress.Report((i + 1) * 0.01d);
                    }
                }, null, loadingFlg).ConfigureAwait(false);

                loadingFlg = !loadingFlg;
            });


            CustomLoadingCommand.Subscribe(async _ =>
            {
                var customLoading = Loading.Instance.Create <MyIndicatorView>(new
                {
                    Message = "Loading...",
                    VAlign  = VAlign.Value,
                    HAlign  = HAlign.Value,
                    OffsetX = OffsetX.Value,
                    OffsetY = OffsetY.Value
                });
                await customLoading.StartAsync(async p =>
                {
                    await Task.Delay(1);
                    p.Report(0d);
                    for (var i = 0; i < 100; i++)
                    {
                        await Task.Delay(25);
                        p.Report((i + 1) * 0.01d);
                    }
                });
            });

            var dlgPage = new MyDialogView();


            DialogCommand.Subscribe(async _ =>
            {
                //var ret = await redlg.ShowAsync();

                //dlg.Dispose();
                var vmm = new {
                    Title          = "Title", Description = "This is a forms view.",
                    VAlign         = VAlign.Value,
                    HAlign         = HAlign.Value,
                    OffsetX        = OffsetX.Value,
                    OffsetY        = OffsetY.Value,
                    IsPageLocation = UseCurrentPageLocation.Value,
                };

                var ret = await Dialog.Instance.ShowAsync <MyDialogView>(vmm);
                //var ret = await Dialog.Instance.ShowAsync(page, vm);
            });

            ToastCommand.Subscribe(_ =>
            {
                Toast.Instance.Show <MyToastView>(new {
                    VAlign = VAlign.Value, HAlign = HAlign.Value, OffsetX = OffsetX.Value, OffsetY = OffsetY.Value
                });
            });
        }