コード例 #1
0
        void ExecuteCloseDialogCommand(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                result = ButtonResult.Yes;
            }
            else if (parameter?.ToLower() == "false")
            {
                result = ButtonResult.No;
            }

            RaiseRequestClose(new DialogResult(result));
        }
コード例 #2
0
        private void CloseDialog(string parameter)
        {
            ButtonResult result             = ButtonResult.None;
            var          transportParameter = new DialogParameters();
            string       parameterValue     = string.Empty;

            if (parameter?.ToLower() == "true")
            {
                result         = ButtonResult.OK;
                parameterValue = "ButtonResult.OK";
            }

            transportParameter.Add("submessage", parameterValue);
            RaiseRequestClose(result, transportParameter);
        }
コード例 #3
0
        public override void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                result = ButtonResult.OK;
            }
            else if (parameter?.ToLower() == "false")
            {
                result = ButtonResult.Cancel;
            }

            CloseDialogWindow(new DialogResult(result));
        }
コード例 #4
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "yes")
            {
                result = ButtonResult.Yes;
            }
            else if (parameter?.ToLower() == "no")
            {
                result = ButtonResult.No;
            }

            RaiseRequestClose(new DialogResult(result));
        }
コード例 #5
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                result = ButtonResult.OK;
            }
            else if (parameter?.ToLower() == "false")
            {
                result = ButtonResult.Cancel;
            }

            RaiseRequestClose(new DialogResult(result));
        }
コード例 #6
0
ファイル: DiagnosisAddViewModel.cs プロジェクト: PvtPepe/Kurs
 private void Add()
 {
     if (TDiagnosis.DiagnosisName != null && TDiagnosis.DiagnosisTreatment != null)
     {
         ButtonResult result = ButtonResult.OK;
         if (ButtonName == "add")
         {
             repo.Add(TDiagnosis);
         }
         else
         {
             repo.Update(TDiagnosis);
         }
         RequestClose(new DialogResult(result));
     }
 }
コード例 #7
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                DataBase.DeleteApplicant(int.Parse(ID));
                result = ButtonResult.OK;
            }
            else if (parameter?.ToLower() == "false")
            {
                result = ButtonResult.Cancel;
            }

            RaiseRequestClose(new DialogResult(result));
        }
コード例 #8
0
        protected virtual void CloseDialog(string parameter)
        {
            if (parameter == "true")
            {
                ButtonResult result = ButtonResult.OK;

                if (Child.FirstName == "" || Child.LastName == "" || Child.Weight == 0 || Child.Length == 0)
                {
                    MessageBox.Show("Please fill out all fields", "Error", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                }
                else
                {
                    RequestClose(new DialogResult(result));
                }
            }
        }
コード例 #9
0
        private void OnOkCommand()
        {
            var preference = PreferenceService.Preference;

            preference.Rounding            = (RoundingRule)Enum.ToObject(typeof(RoundingRule), RoundingRuleIndex.Value);
            preference.RoundUnit           = RoundUnit.Value;
            preference.StartMargin         = StartMargin.Value;
            preference.EndMargin           = EndMargin.Value;
            preference.FirstDayOfWeek      = (DayOfWeek)Enum.ToObject(typeof(DayOfWeek), FirstDayIndex.Value);
            preference.DayOffsetMinutes    = DayOffset.Value;
            preference.MaxDays             = MaxDays.Value;
            preference.EnableBlackoutDates = EnableBlackoutDates.Value;
            PreferenceService.Save();

            ButtonResult result = RescanRequired ? ButtonResult.Retry : ButtonResult.OK;

            RequestClose?.Invoke(new DialogResult(result));
        }
コード例 #10
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "ok")
            {
                result = ButtonResult.OK;
            }
            else if (parameter?.ToLower() == "cancel")
            {
                result = ButtonResult.Cancel;
            }
            var x = new DialogParameters();

            x.Add("amount", Amount);
            x.Add("time", Seconds);
            RaiseRequestClose(new DialogResult(result, x));
        }
コード例 #11
0
        private List <ButtonResult> initResultButtons(int i_RowNumber)
        {
            List <ButtonResult> resultButtons = new List <ButtonResult>();
            int k_ButtonsPerRow = k_SequenceLength / k_ResultButtonRows;

            for (int i = 0; i < k_ResultButtonRows; i++)
            {
                for (int j = 0; j < k_ButtonsPerRow; j++)
                {
                    Point        buttonLocation = getResultButtonLocation(i, j, i_RowNumber);
                    ButtonResult resultButton   = new ButtonResult(buttonLocation, k_ResultButtonSize);
                    this.Controls.Add(resultButton);
                    resultButtons.Add(resultButton);
                }
            }

            return(resultButtons);
        }
コード例 #12
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                result = ButtonResult.OK;
                DocumentsSettings.SaveSettings();
            }
            else
            {
                if (parameter?.ToLower() == "false")
                {
                    result = ButtonResult.Cancel;
                }
            }

            RaiseRequestClose(new Prism.Services.Dialogs.DialogResult(result));
        }
コード例 #13
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                Applicant applicant = new Applicant(ID, parameters[1], parameters[2], parameters[3], parameters[4], parameters[5]);
                EditApplicant(applicant);
                result = ButtonResult.OK;
            }
            else
            {
                if (parameter?.ToLower() == "false")
                {
                    result = ButtonResult.Cancel;
                }
            }
            RaiseRequestClose(new DialogResult(result));
        }
コード例 #14
0
        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
            Ok     = this.FindControl <Button>("Ok");
            Cancel = this.FindControl <Button>("Cancel");
            Text   = this.FindControl <TextBlock>("Text");

            Ok.Click += (s, e) =>
            {
                _result = ButtonResult.Ok;
                Close();
            };

            Cancel.Click += (s, e) =>
            {
                _result = ButtonResult.Cancel;
                Close();
            };
        }
コード例 #15
0
        protected override void OnClose(string obj)
        {
            ButtonResult result = ButtonResult.None;

            switch (obj.ToLower())
            {
            case "0":
                result = ButtonResult.Yes;
                break;

            case "1":
                result = ButtonResult.No;
                break;

            case "2":
                result = ButtonResult.Cancel;
                break;
            }
            RaiseRequestClose(new DialogResult(result));
        }
コード例 #16
0
        /// <summary>
        /// 确认下载事件
        /// </summary>
        private void ExecuteDownloadCommand()
        {
            if (Directory == null || Directory == string.Empty)
            {
                return;
            }

            // 设此文件夹为默认下载文件夹
            if (IsDefaultDownloadDirectory)
            {
                SettingsManager.GetInstance().IsUseSaveVideoRootPath(AllowStatus.YES);
            }
            else
            {
                SettingsManager.GetInstance().IsUseSaveVideoRootPath(AllowStatus.NO);
            }

            // 将Directory移动到第一项
            // 如果直接在ComboBox中选择的就需要
            // 否则选中项不会在下次出现在第一项
            ListHelper.InsertUnique(DirectoryList, Directory, 0);

            // 将更新后的DirectoryList写入历史中
            SettingsManager.GetInstance().SetSaveVideoRootPath(Directory);
            SettingsManager.GetInstance().SetHistoryVideoRootPaths(DirectoryList);

            // 返回数据
            ButtonResult      result     = ButtonResult.OK;
            IDialogParameters parameters = new DialogParameters
            {
                { "directory", Directory },
                { "downloadAudio", DownloadAudio },
                { "downloadVideo", DownloadVideo },
                { "downloadDanmaku", DownloadDanmaku },
                { "downloadSubtitle", DownloadSubtitle },
                { "downloadCover", DownloadCover }
            };

            RaiseRequestClose(new DialogResult(result, parameters));
        }
コード例 #17
0
        private ButtonResult ShowMessage(VectorImage image, string type, string message)
        {
            ButtonResult result = ButtonResult.None;

            if (dialogService == null)
            {
                return(result);
            }

            DialogParameters param = new DialogParameters
            {
                { "image", image },
                { "title", type },
                { "message", message }
            };

            dialogService.ShowDialog(ViewAlertDialogViewModel.Tag, param, buttonResult =>
            {
                result = buttonResult.Result;
            });
            return(result);
        }
コード例 #18
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.None;

            switch (parameter?.ToLower())
            {
            case "ok":
                result = ButtonResult.OK;
                break;

            case "yes":
                result = ButtonResult.Yes;
                break;

            case "no":
                result = ButtonResult.No;
                break;

            case "cancel":
                result = ButtonResult.Cancel;
                break;
            }
            RaiseRequestClose(new DialogResult(result));
        }
コード例 #19
0
 public override void setData(AlertData data, ButtonResult result)
 {
     base.result = result;
     base.data   = data;
 }
コード例 #20
0
 private void RaiseRequestClose(ButtonResult dialogResult, IDialogParameters dialogParameters)
 => RequestClose?.Invoke(new DialogResult(dialogResult, dialogParameters));
コード例 #21
0
        protected virtual void CloseDialog(string parameter)
        {
            ButtonResult result = ButtonResult.OK;

            RaiseRequestClose(new DialogResult(result));
        }
コード例 #22
0
        protected virtual void CloseDialog(string parameter)
        {
            CanClose = true;
            ButtonResult result = ButtonResult.None;

            if (parameter?.ToLower() == "true")
            {
                if (DateTime.Compare(Appointment.StartTime, DateTime.Now) < 0)
                {
                    CanClose = false;
                    MessageBox.Show("Appointment start cannot be earlier than present date/time");
                    return;
                }

                if (Appointment.StartTime > Appointment.EndTime)
                {
                    CanClose = false;
                    MessageBox.Show("Appointment start cannot be later than end date/time");
                }

                if (Appointment.Parents.MomCPR == "" || Appointment.Room.RoomNumber == 0)
                {
                    MessageBox.Show("Please fill out all required fields", "Error");
                    CanClose = false;
                }

                else
                {
                    Cpr = Appointment.Parents.MomCPR;
                    CheckCPR("mother");

                    if (Appointment.Parents.DadCPR != "")
                    {
                        Cpr = Appointment.Parents.DadCPR;
                        CheckCPR("father");
                    }
                }

                if (CanClose)
                {
                    switch (RoomType[RoomTypeIndex])
                    {
                    case "Rest Room":
                        AddAppointmentToRestRoom();
                        break;

                    case "Birth Room":
                        AddAppointmentToBirthRoom();
                        break;

                    case "Maternity Room":
                        AddAppointmentToMaternityRoom();
                        break;
                    }
                }

                if (CanClose)
                {
                    result           = ButtonResult.OK;
                    _okButtonPressed = true;
                }
            }
            else if (parameter?.ToLower() == "false")
            {
                result = ButtonResult.Cancel;
            }



            if (CanClose)
            {
                RequestClose(new DialogResult(result));
            }
        }
コード例 #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogResult"/> class.
 /// </summary>
 /// <param name="result">The result of the dialog.</param>
 public DialogResult(ButtonResult result)
 {
     Result = result;
     Args   = new Dictionary <string, object>();
 }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogResult"/> class.
 /// </summary>
 /// <param name="result">The result of the dialog.</param>
 /// <param name="args">The parameters from the dialog.</param>
 public DialogResult(ButtonResult result, IDictionary <string, object> args)
 {
     Result = result;
     Args   = args;
 }
コード例 #25
0
 protected void CloseDialog(ButtonResult buttonResult)
 {
     RequestClose?.Invoke(new DialogResult(buttonResult));
 }
コード例 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogResult"/> class.
 /// </summary>
 /// <param name="result">The result of the dialog.</param>
 /// <param name="parameters">The parameters from the dialog.</param>
 public DialogResult(ButtonResult result, IDialogParameters parameters)
 {
     Result     = result;
     Parameters = parameters;
 }
コード例 #27
0
        async void ExecuteCloseDialogCommand()
        {
            ButtonResult result = ButtonResult.No;

            await RaiseRequestClose(new DialogResult(result));
        }
コード例 #28
0
 public CommonResult(IDialogParameters parameters, ButtonResult result)
 {
     Parameters = parameters;
     Result     = result;
 }
コード例 #29
0
 public void OnDialogClosed(ButtonResult result)
 {
     RequestClose?.Invoke(new DialogResult(result));
 }
コード例 #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogResult"/> class.
 /// </summary>
 /// <param name="result">The result of the dialog.</param>
 public DialogResult(ButtonResult result) => Result = result;