コード例 #1
0
        public DialogWindow(string t, string m, DialogStyle s = DialogStyle.OK)
        {
            InitializeComponent();

            MessageTitle.Content = t;
            MessageText.Text     = m;

            if (s == DialogStyle.OK)
            {
                Type.Content  = _OK;
                OK.Visibility = System.Windows.Visibility.Visible;
            }
            else if (s == DialogStyle.OKCANCEL)
            {
                Type.Content   = _OKCANCEL;
                Yes.Visibility = System.Windows.Visibility.Visible;
                No.Visibility  = System.Windows.Visibility.Visible;
            }
            else
            {
                Type.Content       = _OKCANCEL;
                Botton1.Visibility = System.Windows.Visibility.Visible;
                Botton2.Visibility = System.Windows.Visibility.Visible;
                Botton3.Visibility = System.Windows.Visibility.Visible;
            }
        }
コード例 #2
0
        private void EnsurePopup(DialogStyle style)
        {
            if (_popup != null)
            {
                return;
            }

            _popup = new Popup();
            Debug.Assert(AppRoot != null);
            AppRoot.Children.Add(_popup);
            _grid        = new Grid();
            _popup.Child = _grid;

            if (style != DialogStyle.NonModal)
            {
                _canvas = new Canvas();
                _canvas.MouseLeftButtonDown += (sender, e) => OnClickOutside();

                switch (style)
                {
                case DialogStyle.Modal:
                    _canvas.Background = new SolidColorBrush(Colors.Transparent);
                    break;

                case DialogStyle.ModalDimmed:
                    _canvas.Background = new SolidColorBrush(Color.FromArgb(0x20, 0x80, 0x80, 0x80));
                    break;
                }

                _grid.Children.Add(_canvas);
            }
            _grid.Children.Add(GetContent());

            UpdateSize();
        }
コード例 #3
0
        private MessageDialogStyle ConvertToMahAppsDialogStyle(DialogStyle style)
        {
            MessageDialogStyle mahAppsDialogStyle = MessageDialogStyle.Affirmative;

            switch (style)
            {
            case DialogStyle.Affirmative:
                mahAppsDialogStyle = MessageDialogStyle.Affirmative;
                break;

            case DialogStyle.AffirmativeAndNegative:
                mahAppsDialogStyle = MessageDialogStyle.AffirmativeAndNegative;
                break;

            case DialogStyle.AffirmativeAndNegativeAndDoubleAuxiliary:
                mahAppsDialogStyle = MessageDialogStyle.AffirmativeAndNegativeAndDoubleAuxiliary;
                break;

            case DialogStyle.AffirmativeAndNegativeAndSingleAuxiliary:
                mahAppsDialogStyle = MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary;
                break;
            }

            return(mahAppsDialogStyle);
        }
コード例 #4
0
        const string _OKCANCEL = "\uE17E\uE11B"; // ?

        #endregion Fields

        #region Constructors

        public DialogWindow(string t, string m, DialogStyle s = DialogStyle.OK)
        {
            InitializeComponent();

            MessageTitle.Content = t;
            MessageText.Text = m;

            if (s == DialogStyle.OK)
            {
                Type.Content = _OK;
                OK.Visibility = System.Windows.Visibility.Visible;
            }
            else if (s == DialogStyle.OKCANCEL)
            {
                Type.Content = _OKCANCEL;
                Yes.Visibility = System.Windows.Visibility.Visible;
                No.Visibility = System.Windows.Visibility.Visible;
            }
            else
            {
                Type.Content = _OKCANCEL;
                Botton1.Visibility = System.Windows.Visibility.Visible;
                Botton2.Visibility = System.Windows.Visibility.Visible;
                Botton3.Visibility = System.Windows.Visibility.Visible;
            }
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DialogData"/> struct.
 /// </summary>
 /// <param name="style">Style to display the dialog as.</param>
 /// <param name="caption">Caption to use to show in the boxes header.</param>
 /// <param name="info">Actual content to show inside dialog.</param>
 /// <param name="leftButton">Text on the left button.</param>
 /// <param name="rightButton">Optional text on the right button.</param>
 public DialogData(DialogStyle style, string caption, string info, string leftButton, string rightButton)
 {
     this.Style       = style;
     this.Caption     = caption;
     this.Info        = info;
     this.LeftButton  = leftButton;
     this.RightButton = rightButton;
 }
コード例 #6
0
ファイル: Chat.cs プロジェクト: UTINKA/SAMP-API
        public void ShowDialog(DialogStyle style, string caption, string text, string button = "", string button2 = "")
        {
            List <byte> ptr = new List <byte>();

            ptr.Add(0xB9);
            ptr.AddRange(BitConverter.GetBytes((uint)Memory.dialog));
            Memory.Call(Memory.functionShowDialog, ptr.ToArray(), false, 1, (int)style, caption, text, button, button2, 0);
        }
コード例 #7
0
ファイル: Dialog.cs プロジェクト: WLSF/SampSharp
        /// <summary>
        ///     Initializes a new instance of the Dialog class.
        /// </summary>
        /// <param name="style">The style of the dialog.</param>
        /// <param name="caption">
        ///     The title at the top of the dialog. The length of the caption can not exceed more than 64
        ///     characters before it starts to cut off.
        /// </param>
        /// <param name="message">The text to display in the main dialog. Use \n to start a new line and \t to tabulate.</param>
        /// <param name="button1">The text on the left button.</param>
        /// <param name="button2">The text on the right button. Leave it blank to hide it.</param>
        public Dialog(DialogStyle style, string caption, string message, string button1, string button2 = null)
        {
            if (caption == null) throw new ArgumentNullException("caption");
            if (message == null) throw new ArgumentNullException("message");
            if (button1 == null) throw new ArgumentNullException("button1");

            Style = style;
            Caption = caption;
            Message = message;
            Button1 = button1;
            Button2 = button2;
        }
コード例 #8
0
    public void CloseDialog()
    {
        if (dialogQueue.Count <= 0)
        {
            return;
        }

        GameObject  go            = dialogQueue.Pop();
        var         ds            = go.GetComponent <DialogBase>();
        DialogStyle goDialogStyle = ds == null ? DialogStyle.NormalDialog : ds.style;

//		AdjustPanelDepth(go, false);
        Debug.Log("close dialog " + go.name);
        PlayCloseDialogAnimation(go);

        if (dialogQueue.Count > 0)
        {
            DialogBase topDb = dialogQueue.Peek().GetComponent <DialogBase>();
            if (topDb != null && goDialogStyle == DialogStyle.NormalDialog)
            {
                topDb.OnResume();
            }
        }

        // check full screen dialog exist
        foreach (var item in dialogQueue)
        {
            if (item != null)
            {
                DialogBase dlg = item.GetComponent <DialogBase>();
                if (dlg != null && dlg.IsFullScreen())
                {
                    return;
                }
            }
        }
        if (mainNode != null && dialogQueue.Count == 0)           // no fullscreen dialog exist
        {
            mainNode.SetActive(true);
            if (middleNode != null)
            {
                middleNode.SetActive(true);
            }
        }

        if (dialogQueue.Count == 0)
        {
            currentMaxDepth = BASE_DEPTH;
        }

//		EventService.Instance.GetEvent<TutorialEvent>().Publish(SettingManager.Instance.TutorialSeq);
    }
コード例 #9
0
ファイル: Dialog.cs プロジェクト: Unimat2809/Myra
        public Dialog(DialogStyle style) : base(style)
        {
            InternalChild.RowsProportions.Add(new Proportion());

            var buttonsGrid = new Grid()
            {
                ColumnSpacing       = 8,
                HorizontalAlignment = HorizontalAlignment.Right,
                GridRow             = 2
            };

            buttonsGrid.ColumnsProportions.Add(new Proportion());
            buttonsGrid.ColumnsProportions.Add(new Proportion());

            ButtonOk = new Button
            {
                Text = "Ok"
            };

            ButtonOk.Click += (sender, args) =>
            {
                if (!CanCloseByOk())
                {
                    return;
                }

                Result = true;
                Close();
            };

            buttonsGrid.Widgets.Add(ButtonOk);

            ButtonCancel = new Button
            {
                Text       = "Cancel",
                GridColumn = 1
            };

            ButtonCancel.Click += (sender, args) =>
            {
                Result = false;
                Close();
            };

            buttonsGrid.Widgets.Add(ButtonCancel);

            InternalChild.Widgets.Add(buttonsGrid);
        }
コード例 #10
0
        public async Task <DialogResult> ShowMessage(string title, string message, DialogStyle style = DialogStyle.Affirmative, DialogSettings settings = null)
        {
            var x = await Application.Current.Dispatcher.InvokeAsync(() =>
            {
                return(this.ShowMessageAsync(title, message, (MessageDialogStyle)style, settings != null ? new BridgeMetroDialogSettings(settings) : null));
            });

            x.Wait();

            if (x.Exception != null)
            {
                throw x.Exception;
            }

            return((DialogResult)x.Result);
        }
コード例 #11
0
        ///<summary>
        /// Show Dialog
        ///</summary>
        ///<param name="style"></param>
        ///<exception cref="InvalidOperationException"></exception>
        public void Show(DialogStyle style)
        {
            if (_isShowing)
            {
                throw new InvalidOperationException();
            }

            _isShowing = true;

            EnsurePopup(style);

            _popup.IsOpen = true;

#if SILVERLIGHT
            Application.Current.Host.Content.Resized += OnPluginSizeChanged;
#endif
        }
コード例 #12
0
        /// <inheritdoc />
        public void ShowDialog(
            int dialogid,
            DialogStyle style,
            string caption,
            string info,
            string buttonLeft,
            string buttonRight = "")
        {
            Guard.Argument(dialogid, nameof(dialogid)).NotNegative();
            Guard.Argument(caption, nameof(caption)).NotNull();
            Guard.Argument(info, nameof(info)).NotNull();
            Guard.Argument(buttonLeft, nameof(buttonLeft)).NotNull();
            Guard.Argument(buttonRight, nameof(buttonRight)).NotNull();
            Guard.Disposal(this.Disposed);

            this.sampNatives.ShowPlayerDialog(this.Id, dialogid, (int)style, caption, info, buttonLeft, buttonRight);
        }
コード例 #13
0
ファイル: Extensions.cs プロジェクト: redrick-tmn2/Coins
        public static MessageDialogStyle ToMessageDialogStyle(this DialogStyle dialogStyle)
        {
            switch (dialogStyle)
            {
            case DialogStyle.Affirmative:
                return(MessageDialogStyle.Affirmative);

            case DialogStyle.AffirmativeAndNegative:
                return(MessageDialogStyle.AffirmativeAndNegative);

            case DialogStyle.AffirmativeAndNegativeAndDoubleAuxiliary:
                return(MessageDialogStyle.AffirmativeAndNegativeAndDoubleAuxiliary);

            case DialogStyle.AffirmativeAndNegativeAndSingleAuxiliary:
                return(MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary);

            default:
                throw new InvalidOperationException($"{dialogStyle} is not supported");
            }
        }
コード例 #14
0
        public void setDialogData(string message, string caption, DialogStyle style)
        {
            Message.Text = message;
            Caption.Text = caption;

            switch (style)
            {
            case DialogStyle.Error:
                Icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.CloseOutline;
                break;

            case DialogStyle.Information:
                Icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.InformationCircleOutline;
                break;

            case DialogStyle.Warning:
                Icon.Kind = MaterialDesignThemes.Wpf.PackIconKind.WarningCircleOutline;
                break;
            }
        }
コード例 #15
0
ファイル: Dialog.cs プロジェクト: WLSF/SampSharp
        /// <summary>
        ///     Initializes a new instance of the Dialog class.
        /// </summary>
        /// <param name="style">The style of the dialog.</param>
        /// <param name="caption">
        ///     The title at the top of the dialog. The length of the caption can not exceed more than 64
        ///     characters before it starts to cut off.
        /// </param>
        /// <param name="message">The text to display in the main dialog. Use \n to start a new line and \t to tabulate.</param>
        /// <param name="button1">The text on the left button.</param>
        /// <param name="button2">The text on the right button. Leave it blank to hide it.</param>
        public Dialog(DialogStyle style, string caption, string message, string button1, string button2 = null)
        {
            if (caption == null)
            {
                throw new ArgumentNullException("caption");
            }
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            if (button1 == null)
            {
                throw new ArgumentNullException("button1");
            }

            Style   = style;
            Caption = caption;
            Message = message;
            Button1 = button1;
            Button2 = button2;
        }
コード例 #16
0
        /// <inheritdoc cref="DialogManager.ShowMessageAsync(object, string, string, DialogStyle, IDialogSettings)"/>
        /// <param name="timeout">The time, in millseconds, until the dialog is automatically closed</param>
        /// <returns>The <see cref="DialogResult"/> selected by the user, or <see cref="DialogResult.Canceled"/>
        /// if the dialog is closed by <see cref="CancellationToken"/></returns>
        public static async Task <DialogResult> ShowMessageWithTimeoutAsync(
            this IDialogManager value,
            object context,
            string title,
            string message,
            DialogStyle style        = DialogStyle.Affirmative,
            IDialogSettings settings = null,
            int timeout = 5000)
        {
            using (var linkedSource = CancellationTokenSource.CreateLinkedTokenSource(settings.CancellationToken))
            {
                settings.CancellationToken = linkedSource.Token;
                linkedSource.CancelAfter(timeout);

                // Supplying a CancellationToken to DialogSettings currently results in threading access error
                // See: https://github.com/MahApps/MahApps.Metro/issues/3214
                // For the time being the token must be removed, it will therefore be unable to close the dialog
                settings.CancellationToken = default;

                return(await value.ShowMessageAsync(context, title, message, style, settings));
            }
        }
コード例 #17
0
ファイル: Chat.cs プロジェクト: shadowIdeas/shadowAPI2
        public static void ShowDialog(DialogStyle style, string caption, string text, string button = "", string button2 = "")
        {
            Memory.Init();

            List<byte> ptr = new List<byte>();
            ptr.Add(0xB9);
            ptr.AddRange(BitConverter.GetBytes((uint)dialog));
            Memory.Call(functionShowDialog, ptr.ToArray(), false, 1, (int)style, caption, text, button, button2, 0);
        }
コード例 #18
0
        public async Task <DialogResult> ShowMessageAsync(string title, string message, DialogStyle style = DialogStyle.Affirmative, DialogSettings settings = null)
        {
            var metroStyle = Metro.MessageDialogStyle.Affirmative;

            if (style == DialogStyle.AffirmativeAndNegative)
            {
                metroStyle = Metro.MessageDialogStyle.AffirmativeAndNegative;
            }
            else
            {
                metroStyle = Metro.MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary;
            }

            var defaultButtonFocus = settings?.DefaultButtonFocus.ToMetro() ?? Metro.MessageDialogResult.Affirmative;

            defaultButtonFocus = defaultButtonFocus == Metro.MessageDialogResult.Canceled ? Metro.MessageDialogResult.FirstAuxiliary : defaultButtonFocus;

            var result = await _dialog.ShowMessageAsync(_context, title, message, metroStyle, new Metro.MetroDialogSettings
            {
                FirstAuxiliaryButtonText = settings?.CancelButtonText ?? "Cancel",
                AffirmativeButtonText    = settings?.AffirmativeButtonText ?? "Ok",
                NegativeButtonText       = settings?.NegativeButtonText ?? "No",
                DefaultButtonFocus       = defaultButtonFocus,
                AnimateHide = false
            });

            return(result.ToAdapter());
        }
コード例 #19
0
ファイル: DialogManager.cs プロジェクト: Erik-White/Mosey
        public async Task <DialogResult> ShowMessageAsync(object context, string title, string message, DialogStyle style = DialogStyle.Affirmative, IDialogSettings settings = null)
        {
            var result = await Instance.ShowMessageAsync(
                context, title, message, style.ToMetroDialogStyle(), settings?.ToMetroDialogSettings());

            return(result.ToDialogResult());
        }
コード例 #20
0
        public async Task <DialogResult> ShowMessageAsync(object context, string title, string message, DialogStyle style = DialogStyle.Affirmative)
        {
            MessageDialogStyle mahAppsDialogStyle = ConvertToMahAppsDialogStyle(style);

            //Task<MessageDialogResult> task = _dialogCoordinator.ShowMessageAsync(context, title, message, mahAppsDialogStyle);
            MessageDialogResult result = await _dialogCoordinator.ShowMessageAsync(context, title, message, mahAppsDialogStyle);

            //MessageDialogResult mahAppsMessageDialogResult = awaiter.GetResult();/*task.Result;*/

            return(ConvertToBaseDialogResult(result));
            //return DialogResult.Affirmative;
        }
コード例 #21
0
 /// <summary>
 /// Convert <see cref="DialogStyle"/> to <see cref="MessageDialogStyle"/>
 /// </summary>
 /// <param name="value"></param>
 /// <returns>An equivalent <see cref="MessageDialogStyle"/> instance</returns>
 internal static MessageDialogStyle ToMetroDialogStyle(this DialogStyle value)
 => (MessageDialogStyle)value;
コード例 #22
0
ファイル: DialogManager.cs プロジェクト: Erik-White/Mosey
 public DialogResult ShowModalMessageExternal(object context, string title, string message, DialogStyle style = DialogStyle.Affirmative, IDialogSettings settings = null)
 => Instance.ShowModalMessageExternal(
     context,
     title,
     message,
     style.ToMetroDialogStyle(),
     settings?.ToMetroDialogSettings()).ToDialogResult();
コード例 #23
0
 public DialogDataProvider(Window mainWindow, DialogStyle style = DialogStyle.Standard)
 {
     DialogStyleInUse = style;
     MainWindow       = mainWindow;
 }
コード例 #24
0
        public static DialogResult Show(string message, string caption, DialogButtons buttons, DialogStyle style, bool IsBackGround = false)
        {
            DialogResult result = DialogResult.Cancel;

            if (IsBackGround != false)
            {
                Items.mainWindow.GridBackgroundDialog.Visibility = Visibility.Visible;
            }

            switch (buttons)
            {
            case DialogButtons.Ok:
                var dialog = new DialogOk();
                dialog.setDialogData(message, caption, style);
                dialog.ShowDialog();
                result = dialog.result;
                break;

            case DialogButtons.OkNo:
                var dialog1 = new DialogOkNo();
                dialog1.setDialogData(message, caption, style);
                dialog1.ShowDialog();
                result = dialog1.result;
                break;

            case DialogButtons.OkNoCancel:
                var dialog2 = new DialogOkNoCancel();
                dialog2.setDialogData(message, caption, style);
                dialog2.ShowDialog();
                result = dialog2.result;
                break;
            }

            if (IsBackGround != false)
            {
                Items.mainWindow.GridBackgroundDialog.Visibility = Visibility.Hidden;
            }

            return(result);
        }
コード例 #25
0
ファイル: DialogStyle.cs プロジェクト: kopffarben/Myra
 public DialogStyle(DialogStyle style) : base(style)
 {
 }
コード例 #26
0
ファイル: DialogStyle.cs プロジェクト: mystborn/Myra
 public DialogStyle(DialogStyle style) : base(style)
 {
     OkButtonStyle     = style.OkButtonStyle != null ? new ImageTextButtonStyle(style.OkButtonStyle) : null;
     CancelButtonStyle = style.CancelButtonStyle != null ? new ImageTextButtonStyle(style.CancelButtonStyle) : null;
 }
コード例 #27
0
 public DialogDataProvider(Window mainWindow, DialogStyle style = DialogStyle.Standard)
 {
     DialogStyleInUse = style;
     MainWindow = mainWindow;
 }