コード例 #1
0
        public DialogCommand(DialogViewModel owner, string name, DialogResultType cause)
        {
            if(owner == null) throw new ArgumentNullException("owner");

            _owner = owner;
            Name = name;
            Cause = cause;
        }
コード例 #2
0
 private void CloseDialog(DialogResultType dialogResult)
 {
     if (Dialog != null)
     {
         Dialog.ResultArgs.DialogResult = dialogResult;
         Dialog.Close();
     }
 }
コード例 #3
0
 private void CloseDialog(DialogResultType dialogResult, List <ErrorProduct> errorProductList)
 {
     if (Dialog != null)
     {
         Dialog.ResultArgs.DialogResult = dialogResult;
         Dialog.ResultArgs.Data         = errorProductList;
         Dialog.Close();
     }
 }
コード例 #4
0
 private void MetroWindow_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (Keyboard.IsKeyDown(Key.Escape))
     {
         DialogResult = DialogResultType.Cancel;
         e.Handled    = true;
         this.Close();
     }
 }
コード例 #5
0
 private void CloseDialog(DialogResultType result)
 {
     if (DialogHandle != null)
     {
         DialogHandle.ResultArgs = new ResultEventArgs
         {
             DialogResult = result
         };
         DialogHandle.Close();
     }
 }
コード例 #6
0
        /// <summary>
        /// 显示同步对话框
        /// </summary>
        /// <param name="Owner">对话框所属窗体,默认是MainWindow</param>
        /// <param name="description">主要信息描述</param>
        /// <param name="mark">备注信息</param>
        /// <param name="SettingType">按钮显示类型</param>
        /// <param name="width">对话框宽度</param>
        /// <param name="height">对话框高度</param>
        public static DialogResultType ShowDialog(this Window Owner, string Caption, string mark = "", DialogSettingType SettingType = DialogSettingType.OkAndCancel, DialogType WindowType = DialogType.Warning, double?width = null, double?height = null, bool showChecked = false, string checkedString = "")
        {
            DialogResultType result = DialogResultType.None;

            DispatcherHelper.UIDispatcher.Invoke(() =>
            {
                DialogWindow dialogwin = new DialogWindow(Owner);
                result = dialogwin.ShowDialog(Caption, mark, showChecked, checkedString, SettingType, WindowType, width, height);
            });
            return(result);
        }
コード例 #7
0
        public static DialogResultType ShowDialog(DialogWindowSettings Settings)
        {
            DialogResultType result = DialogResultType.None;

            DispatcherHelper.UIDispatcher.Invoke(() =>
            {
                DialogWindow dialogwin = new DialogWindow();
                dialogwin.SettingWindow(Settings);
                result = dialogwin.ShowDialog();
            });
            return(result);
        }
コード例 #8
0
ファイル: PopWindow.cs プロジェクト: sanlonezhang/ql
 /// <summary>
 /// 关闭弹出框
 /// </summary>
 /// <param name="data"></param>
 /// <param name="dialogResult"></param>
 protected void CloseDialog(object data, DialogResultType dialogResult)
 {
     if (CurrentDialog != null)
     {
         CurrentDialog.ResultArgs = new ResultEventArgs()
         {
             Data         = data,
             DialogResult = dialogResult,
         };
         CurrentDialog.Close();
     }
 }
コード例 #9
0
        protected DialogCommand BuildDefaultCommand(string name, DialogResultType cause, bool isAccept = false, bool isCancel = false)
        {
            var command = new DialogCommand(this, name, cause)
            {
                IsDefaultAccept = isAccept,
                IsDefaultCancel = isCancel
            };

            if (isAccept)
            {
                command.CommandType = CommandType.DefaultConfirm;
            }

            return command;
        }
コード例 #10
0
        public static DialogResultType ShowDialogConfirm(this ViewModelBase ViewModel, out bool select, string Caption, string selectstring = "", string mark = "", DialogSettingType SettingType = DialogSettingType.OkAndCancel, DialogType WindowType = DialogType.Warning, double?width = null, double?height = null)
        {
            DialogResultType result = DialogResultType.None;

            bool selected = false;

            DispatcherHelper.UIDispatcher.Invoke(() =>
            {
                DialogWindow dialogwin = new DialogWindow();
                dialogwin.Tag          = ViewModel;
                result = dialogwin.ShowDialog(Caption, mark, true, selectstring, SettingType, WindowType, width, height);

                selected = dialogwin.Checked;
            });
            select = selected;
            return(result);
        }
コード例 #11
0
        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            switch (btn.Name)
            {
            case "Btn_Ok":
                DialogResult = DialogResultType.OK;
                break;

            case "Btn_Cancel":
                DialogResult = DialogResultType.Cancel;
                break;
            }

            this.Checked = cb_checked.IsChecked.Value;
            this.Close();
        }
コード例 #12
0
        // Send response
        private async Task SendResponse(IDialogContext context, Response response)
        {
            IMessageActivity activity;

            // Ensure original translation
            DiagnosticsUtil.TraceInformation($"Response locale {_info.Info.Locale}");

            response.Message = await TranslationUtil.ReverseFromSpanishTranslation(response.Message, _info.Info.Locale);

            // Build message
            switch (_info.Info.ChannelId)
            {
            case AlexaBotframework.BotFrameworkBot.Helpers.Constants.Channels.DirectLine:
                activity = BuildDirectLineMessage(context, response);
                break;

            default:
                activity = BuildDefaultMessage(context, response);
                break;
            }

            // Send response
            await context.PostAsync(activity);

            // Check end conversation
            if (response.EndConversation)
            {
                DialogResultType resultType = _context.SurveyCompleted ? DialogResultType.Completed : DialogResultType.Suspended;

                context.Done(resultType);
            }
            else
            {
                context.Wait(MessageReceived);
            }
        }
コード例 #13
0
 /// <summary>
 /// Closes the owning dialog and sets the dialog result to the given cause
 /// </summary>
 /// <param name="cause"></param>
 protected void CloseOwner(DialogResultType cause)
 {
     _owner.DialogResult = cause;
     _owner.Close();
 }
コード例 #14
0
 /// <summary>
 /// Inicia una nueva instancia de la clase <see cref="BaseDialogEventArgs"/>.
 /// </summary>
 /// <param name="_type">The _type.</param>
 public BaseDialogEventArgs(DialogResultType _type)
 {
     this.Type = _type;
 }
コード例 #15
0
 /// <summary>
 /// Inicia una nueva instancia de la clase <see cref="BaseDialogEventArgs"/>.
 /// </summary>
 /// <param name="_type">The _type.</param>
 public BaseDialogEventArgs(DialogResultType _type)
 {
     this.Type = _type;
 }
コード例 #16
0
ファイル: PopWindow.cs プロジェクト: sanlonezhang/ql
 /// <summary>
 /// 关闭弹出框
 /// </summary>
 /// <param name="resultType"></param>
 protected void CloseDialog(DialogResultType resultType)
 {
     CloseDialog(null, resultType);
 }
コード例 #17
0
    public static DialogResultType Dialog(DialogType dialogType, string title, string message, Rect rect, float factor, ref bool showDialog)
    {
        result = DialogResultType.UNDEFINED;

        if (target == 0)
        {
            if (t > 0)
            {
                t -= Time.deltaTime / factor;
            }
        }
        else if (target == 1)
        {
            if (t < 1)
            {
                t += Time.deltaTime / factor;
            }
        }

        t = Mathf.Clamp01(t);

        if (MathUtils.AlmostEqual(t, 0f, 0.01f) && target == 0f)
        {
            //ease = false;
            showDialog = false;
            target     = 1f;
            Debug.Log("Done?" + showDialog);
        }


        if (ease && showDialog)
        {
            if (target == 1)
            {
                currentRect = EasingCurves.EaseRect(
                    closedRect,
                    rect,
                    EasingCurves.EaseType.easeOutExpo,
                    t);
            }
            else if (target == 0)
            {
                currentRect = EasingCurves.EaseRect(
                    closedRect,
                    rect,
                    EasingCurves.EaseType.easeInExpo,
                    t);
            }
        }

        CustomGUIUtils.DrawFrameBox(currentRect, Color.gray, 3f, Color.black);

        //if(t == 1){
        GUILayout.BeginArea(currentRect);
        GUILayout.Label(title, GUILayout.Width(currentRect.width), GUILayout.Height(30f));
        GUILayout.Space(30f);
        GUILayout.BeginHorizontal();
        GUILayout.Space(30f);
        GUILayout.BeginVertical();
        GUILayout.Label(message);

        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        switch (dialogType)
        {
        case DialogType.YES_NO:

            if (GUILayout.Button("Yes"))
            {
                CloseDialog();
                result = DialogResultType.YES;
            }

            if (GUILayout.Button("No"))
            {
                CloseDialog();
                result = DialogResultType.NO;
            }
            break;

        case DialogType.YES_NO_CANCEL:
            if (GUILayout.Button("Yes"))
            {
                CloseDialog();
                result = DialogResultType.YES;
            }
            if (GUILayout.Button("No"))
            {
                CloseDialog();
                result = DialogResultType.NO;
            }
            if (GUILayout.Button("Cancel"))
            {
                CloseDialog();
                result = DialogResultType.CANCEL;
            }

            break;

        case DialogType.OK:
            if (GUILayout.Button("OK"))
            {
                CloseDialog();
                result = DialogResultType.OK;
            }
            break;

        case DialogType.OK_CANCEL:
            if (GUILayout.Button("Cancel"))
            {
                CloseDialog();
                result = DialogResultType.CANCEL;
            }
            break;

        default:
            result = DialogResultType.UNDEFINED;
            break;
        }

        GUILayout.EndHorizontal();

        GUILayout.EndArea();

        return(result);
    }