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


C# IWindowManager.ShowMetroMessageBox方法代码示例

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


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

示例1: MainViewModel

        private MainViewModel(IWindowManager windowManager, IEventAggregator eventAggregator)
        {
            _windowManager = windowManager;
            eventAggregator.Subscribe(this);

            // automatically use the correct translations if available (fallback: en)
            LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
            LocalizeDictionary.Instance.Culture = Thread.CurrentThread.CurrentCulture;

            // this is already defined in the app.manifest, but to be sure check it again
            if (!IsAdministrator())
            {
                _windowManager.ShowMetroMessageBox(
                    LocalizationEx.GetUiString("dialog_message_bad_privileges", Thread.CurrentThread.CurrentCulture),
                    LocalizationEx.GetUiString("dialog_error_title", Thread.CurrentThread.CurrentCulture),
                    MessageBoxButton.OK, BoxType.Error);
                Environment.Exit(1);
            }

            // do a simple check, if all needed files are available
            if (!ValidateDnsCryptProxyFolder())
            {
                _windowManager.ShowMetroMessageBox(
                    LocalizationEx.GetUiString("dialog_message_missing_proxy_files",
                        Thread.CurrentThread.CurrentCulture),
                    LocalizationEx.GetUiString("dialog_error_title", Thread.CurrentThread.CurrentCulture),
                    MessageBoxButton.OK, BoxType.Error);
                Environment.Exit(1);
            }

            DisplayName = string.Format("{0} {1} ({2})", Global.ApplicationName, VersionUtilities.PublishVersion,
                LocalizationEx.GetUiString("global_ipv6_disabled", Thread.CurrentThread.CurrentCulture));
            _resolvers = new List<DnsCryptProxyEntry>();
			//TODO: make UpdateResolverListOnStart configurable by user
			_updateResolverListOnStart = Global.UpdateResolverListOnStart;
            _isWorkingOnPrimaryService = false;
            _isWorkingOnSecondaryService = false;

            LocalNetworkInterfaces = new CollectionViewSource {Source = _localNetworkInterfaces};
            PrimaryDnsCryptProxyManager = new DnsCryptProxyManager(DnsCryptProxyType.Primary);
            SecondaryDnsCryptProxyManager = new DnsCryptProxyManager(DnsCryptProxyType.Secondary);
            ShowHiddenCards = false;


            if (PrimaryDnsCryptProxyManager.DnsCryptProxy.Parameter.TcpOnly ||
                SecondaryDnsCryptProxyManager.DnsCryptProxy.Parameter.TcpOnly)
            {
                _useTcpOnly = true;
            }

            // check the primary resolver for plugins
            if (PrimaryDnsCryptProxyManager.DnsCryptProxy.Parameter.Plugins.Any())
            {
                _plugins = PrimaryDnsCryptProxyManager.DnsCryptProxy.Parameter.Plugins.ToList();
            }
            else
            {
                if (SecondaryDnsCryptProxyManager.DnsCryptProxy.Parameter.Plugins.Any())
                {
                    _plugins = SecondaryDnsCryptProxyManager.DnsCryptProxy.Parameter.Plugins.ToList();
                }
                else
                {
                    // no stored plugins
                    _plugins = new List<string>();
                }
            }

            var proxyList = Path.Combine(Directory.GetCurrentDirectory(),
                Global.DnsCryptProxyFolder, Global.DnsCryptProxyResolverListName);
            var proxyListSignature = Path.Combine(Directory.GetCurrentDirectory(),
                Global.DnsCryptProxyFolder, Global.DnsCryptProxySignatureFileName);
			if (!File.Exists(proxyList) || !File.Exists(proxyListSignature) || UpdateResolverListOnStart)
            {
				// download and verify the proxy list if there is no one.
				AsyncHelpers.RunSync(DnsCryptProxyListManager.UpdateResolverListAsync);
			}

			var dnsProxyList =
                DnsCryptProxyListManager.ReadProxyList(proxyList, proxyListSignature, true);
            if (dnsProxyList != null && dnsProxyList.Any())
            {
                foreach (var dnsProxy in dnsProxyList)
                {
                    if (
                        dnsProxy.Name.Equals(
                            PrimaryDnsCryptProxyManager.DnsCryptProxy.Parameter.ResolverName))
                    {
                        _primaryResolver = dnsProxy;
						// restore the local port
	                    _primaryResolver.LocalPort = PrimaryDnsCryptProxyManager.DnsCryptProxy.Parameter.LocalPort;
                    }
                    if (
                        dnsProxy.Name.Equals(
                            SecondaryDnsCryptProxyManager.DnsCryptProxy.Parameter.ResolverName))
                    {
                        _secondaryResolver = dnsProxy;
                    }
                    _resolvers.Add(dnsProxy);
                }
//.........这里部分代码省略.........
开发者ID:thedroidgeek,项目名称:SimpleDnsCrypt,代码行数:101,代码来源:MainViewModel.cs


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