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


C# IWindow.TranslateForTechnology方法代码示例

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


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

示例1: ShowTaskDialog

        public MsgBoxResult ShowTaskDialog(
            IWindow owner,
            string text,
            string caption,
            MsgBoxButton button,
            MsgBoxImage icon,
            Icon custumIcon)
        {
            return ObservableObject.CurrentDispatcher.Invoke(
                () =>
                {
                    var dialog = new TaskDialog
                    {
                        CenterParent = true,
                        Content = text,
                        ExpandFooterArea = false,
                        ExpandedByDefault = false,
                        MinimizeBox = false,
                        ProgressBarStyle =
                            ProgressBarStyle.None,
                        WindowIcon = custumIcon,
                        WindowTitle = caption,
                        MainInstruction = caption,
                        MainIcon = TranslateIcon(icon)
                    };

                    TranslateButtons(button, dialog.Buttons);
                    TaskDialogButton clickedButton =
                        dialog.ShowDialog(owner != null
                                              ? (Window)
                                                owner
                                                    .TranslateForTechnology
                                                    ()
                                              : null);

                    switch (clickedButton.ButtonType)
                    {
                        case ButtonType.Ok:
                            return MsgBoxResult.Ok;
                        case ButtonType.Yes:
                            return MsgBoxResult.Yes;
                        case ButtonType.No:
                            return MsgBoxResult.No;
                        case ButtonType.Cancel:
                            return MsgBoxResult.Cancel;
                        case ButtonType.Close:
                            return MsgBoxResult.Cancel;
                        default:
                            throw new ArgumentOutOfRangeException();
                    }
                });
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:52,代码来源:DialogFactory.cs

示例2: ShowSaveFileDialog

        public string ShowSaveFileDialog(
            IWindow owner,
            bool addExtension,
            bool checkFileExists,
            bool checkPathExists,
            string defaultExt,
            bool dereferenceLinks,
            string filter,
            bool createPrompt,
            bool overwritePrompt,
            string title,
            string initialDirectory,
            out bool? result)
        {
            bool? tempresult = null;

            try
            {
                return ObservableObject.CurrentDispatcher.Invoke(
                    () =>
                    {
                        var dialog = new VistaSaveFileDialog
                        {
                            AddExtension = addExtension,
                            CheckFileExists = checkFileExists,
                            DefaultExt = defaultExt,
                            DereferenceLinks =
                                dereferenceLinks,
                            Filter = filter,
                            Title = title,
                            CheckPathExists = checkPathExists,
                            CreatePrompt = createPrompt,
                            OverwritePrompt = overwritePrompt,
                            InitialDirectory =
                                initialDirectory
                        };

                        TranslateDefaultExt(dialog);

                        tempresult = owner != null
                                         ? dialog.ShowDialog(
                                             (Window)
                                             owner
                                                 .TranslateForTechnology
                                                 ())
                                         : dialog.ShowDialog();

                        return tempresult == false ? null : dialog.FileName;
                    });
            }
            finally
            {
                result = tempresult;
            }
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:55,代码来源:DialogFactory.cs

示例3: ShowOpenFolderDialog

        public string ShowOpenFolderDialog(
            IWindow owner,
            string description,
            Environment.SpecialFolder rootFolder,
            bool showNewFolderButton,
            bool useDescriptionForTitle,
            out bool? result)
        {
            bool? tempresult = null;

            try
            {
                return ObservableObject.CurrentDispatcher.Invoke(
                    () =>
                    {
                        var dialog = new VistaFolderBrowserDialog
                        {
                            Description = description,
                            RootFolder = rootFolder,
                            ShowNewFolderButton =
                                showNewFolderButton,
                            UseDescriptionForTitle =
                                useDescriptionForTitle
                        };

                        tempresult = owner != null
                                         ? dialog.ShowDialog(
                                             (Window)
                                             owner
                                                 .TranslateForTechnology
                                                 ())
                                         : dialog.ShowDialog();

                        return tempresult == false
                                   ? null
                                   : dialog.SelectedPath;
                    });
            }
            finally
            {
                result = tempresult;
            }
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:43,代码来源:DialogFactory.cs

示例4: ShowOpenFileDialog

        public IEnumerable<string> ShowOpenFileDialog(
            IWindow owner,
            bool checkFileExists,
            string defaultExt,
            bool dereferenceLinks,
            string filter,
            bool multiSelect,
            string title,
            bool validateNames,
            bool checkPathExists,
            out bool? result)
        {
            bool? tempresult = null;

            try
            {
                return ObservableObject.CurrentDispatcher.Invoke(
                    () =>
                    {
                        var dialog = new VistaOpenFileDialog
                        {
                            CheckFileExists = checkFileExists,
                            DefaultExt = defaultExt,
                            DereferenceLinks =
                                dereferenceLinks,
                            Filter = filter,
                            Multiselect = multiSelect,
                            Title = title,
                            ValidateNames = validateNames,
                            CheckPathExists = checkPathExists
                        };

                        TranslateDefaultExt(dialog);

                        tempresult = owner != null
                                         ? dialog.ShowDialog(
                                             (Window)
                                             owner
                                                 .TranslateForTechnology
                                                 ())
                                         : dialog.ShowDialog();

                        return tempresult == false
                                   ? Enumerable.Empty<string>()
                                   : dialog.FileNames;
                    });
            }
            finally
            {
                result = tempresult;
            }
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:52,代码来源:DialogFactory.cs

示例5: ShowMessageBox

        public MsgBoxResult ShowMessageBox(
            IWindow owner,
            string text,
            string caption,
            MsgBoxButton button,
            MsgBoxImage icon,
            Icon custumIcon)
        {
            Window realWindow = owner == null ? null : (Window)owner.TranslateForTechnology();

            return
                ObservableObject.CurrentDispatcher.Invoke(
                    () =>
                    !TaskDialog.OSSupportsTaskDialogs
                        ? (MsgBoxResult)
                          MessageBox.Show(
                              realWindow,
                              text,
                              caption,
                              (MessageBoxButton) button,
                              (MessageBoxImage) icon)
                        : ShowTaskDialog(owner, text, caption, button, icon,
                                         custumIcon));
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:24,代码来源:DialogFactory.cs

示例6: GetText

        /// <summary>
        ///     The get text.
        /// </summary>
        /// <param name="owner">
        ///     The owner.
        /// </param>
        /// <param name="instruction">
        ///     The instruction.
        /// </param>
        /// <param name="content">
        ///     The content.
        /// </param>
        /// <param name="caption">
        ///     The caption.
        /// </param>
        /// <param name="allowCancel">
        ///     The allow cancel.
        /// </param>
        /// <param name="defaultValue">
        ///     The default value.
        /// </param>
        /// <returns>
        ///     The <see cref="string" />.
        /// </returns>
        public string GetText(
            IWindow owner,
            string instruction,
            string content,
            string caption,
            bool allowCancel,
            string defaultValue)
        {
            return ObservableObject.CurrentDispatcher.Invoke(
                () =>
                {
                    Window realWindow = owner == null ? null : (Window) owner.TranslateForTechnology();
                    var diag = new InputDialog
                    {
                        Owner = realWindow,
                        MainText = instruction,
                        AllowCancel = allowCancel,
                        Title = caption,
                        InstructionText = content,
                        Result = defaultValue
                    };

                    return diag.ShowDialog() == true ? diag.Result : null;
                });
        }
开发者ID:Tauron1990,项目名称:Tauron-Application-Common,代码行数:49,代码来源:DialogFactory.cs


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