当前位置: 首页>>代码示例>>C#>>正文


C# ModernDialog.CreateCloseDialogButton方法代码示例

本文整理汇总了C#中FirstFloor.ModernUI.Windows.Controls.ModernDialog.CreateCloseDialogButton方法的典型用法代码示例。如果您正苦于以下问题:C# ModernDialog.CreateCloseDialogButton方法的具体用法?C# ModernDialog.CreateCloseDialogButton怎么用?C# ModernDialog.CreateCloseDialogButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FirstFloor.ModernUI.Windows.Controls.ModernDialog的用法示例。


在下文中一共展示了ModernDialog.CreateCloseDialogButton方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Resolve

        public AcControlsConflictSolution Resolve(string inputDisplayName, IEnumerable<string> existingAssignments) {
            var list = existingAssignments.Select(x => $"“{x}”").ToList();
            var message = list.Count > 1
                    ? string.Format(AppStrings.Controls_AlreadyUsed_MultipleMessage, inputDisplayName,
                            list.SkipLast(1).JoinToString(@", "), list.Last())
                    : string.Format(AppStrings.Controls_AlreadyUsed_Message, inputDisplayName, list.First());

            var dlg = new ModernDialog {
                Title = AppStrings.Controls_AlreadyUsed,
                Content = new ScrollViewer {
                    Content = new BbCodeBlock { BbCode = message, Margin = new Thickness(0, 0, 0, 8) },
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
                },
                MinHeight = 0,
                MinWidth = 0,
                MaxHeight = 480,
                MaxWidth = 640
            };

            dlg.Buttons = new[] {
                dlg.CreateCloseDialogButton(AppStrings.Controls_RemoveOld, true, false, MessageBoxResult.Yes),
                dlg.CreateCloseDialogButton(AppStrings.Controls_ApplyToAll, false, false, MessageBoxResult.No),
                dlg.CreateCloseDialogButton(AppStrings.Controls_SwapUsings, false, false, MessageBoxResult.OK),
                dlg.CreateCloseDialogButton(UiStrings.Cancel, false, true, MessageBoxResult.Cancel),
            };
            dlg.ShowDialog();

            switch (dlg.MessageBoxResult) {
                case MessageBoxResult.Yes:
                    return AcControlsConflictSolution.ClearPrevious;
                case MessageBoxResult.No:
                    return AcControlsConflictSolution.KeepEverything;
                case MessageBoxResult.OK:
                    return AcControlsConflictSolution.Flip;
                case MessageBoxResult.Cancel:
                    return AcControlsConflictSolution.Cancel;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
开发者ID:gro-ove,项目名称:actools,代码行数:41,代码来源:AcSettingsControls.xaml.cs

示例2: ShowDialog

        /// <summary>
        /// Shows dialog with all information about shared entry and offers a choise to user what to do with it.
        /// </summary>
        /// <param name="shared">Shared entry.</param>
        /// <param name="additionalButton">Label of additional button.</param>
        /// <param name="saveable">Can be saved.</param>
        /// <param name="applyable">Can be applied.</param>
        /// <param name="appliableWithoutSaving">Can be applied without saving.</param>
        /// <returns>User choise.</returns>
        private Choise ShowDialog(SharedEntry shared, string additionalButton = null, bool saveable = true, bool applyable = true,
                bool appliableWithoutSaving = true) {
            var description = string.Format(AppStrings.Arguments_SharedMessage, shared.Name ?? AppStrings.Arguments_SharedMessage_EmptyValue,
                    shared.EntryType == SharedEntryType.Weather
                            ? AppStrings.Arguments_SharedMessage_Id : AppStrings.Arguments_SharedMessage_For,
                    shared.Target ?? AppStrings.Arguments_SharedMessage_EmptyValue,
                    shared.Author ?? AppStrings.Arguments_SharedMessage_EmptyValue);

            var dlg = new ModernDialog {
                Title = shared.EntryType.GetDescription().ToTitle(),
                Content = new ScrollViewer {
                    Content = new BbCodeBlock {
                        BbCode = description + '\n' + '\n' + (
                                saveable ? AppStrings.Arguments_Shared_ShouldApplyOrSave : AppStrings.Arguments_Shared_ShouldApply),
                        Margin = new Thickness(0, 0, 0, 8)
                    },
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled
                },
                MinHeight = 0,
                MinWidth = 0,
                MaxHeight = 480,
                MaxWidth = 640
            };

            dlg.Buttons = new[] {
                applyable && saveable ? dlg.CreateCloseDialogButton(
                        appliableWithoutSaving ? AppStrings.Arguments_Shared_ApplyAndSave : AppStrings.Arguments_Shared_SaveAndApply,
                        true, false, MessageBoxResult.Yes) : null,
                appliableWithoutSaving && applyable
                        ? dlg.CreateCloseDialogButton(saveable ? AppStrings.Arguments_Shared_ApplyOnly : AppStrings.Arguments_Shared_Apply,
                                true, false, MessageBoxResult.OK) : null,
                saveable ? dlg.CreateCloseDialogButton(
                        applyable && appliableWithoutSaving ? AppStrings.Arguments_Shared_SaveOnly : AppStrings.Toolbar_Save,
                        true, false, MessageBoxResult.No) : null,
                additionalButton == null ? null : dlg.CreateCloseDialogButton(additionalButton, true, false, MessageBoxResult.None),
                dlg.CancelButton
            }.NonNull();
            dlg.ShowDialog();

            switch (dlg.MessageBoxResult) {
                case MessageBoxResult.None:
                    return Choise.Extra;
                case MessageBoxResult.OK:
                    return Choise.Apply;
                case MessageBoxResult.Cancel:
                    return Choise.Cancel;
                case MessageBoxResult.Yes:
                    return Choise.ApplyAndSave;
                case MessageBoxResult.No:
                    return Choise.Save;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
开发者ID:gro-ove,项目名称:actools,代码行数:64,代码来源:ArgumentsHandler.cs


注:本文中的FirstFloor.ModernUI.Windows.Controls.ModernDialog.CreateCloseDialogButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。