コード例 #1
0
ファイル: App.xaml.cs プロジェクト: sanlonezhang/ql
        private void InitializeParams(Action callback)
        {
            var client = new CommonServiceV40Client();

            client.GetAppParamsCompleted += (sender, e) =>
            {
                var param = e.Result.Body;

                CPApplication.Current.ServerComputerName = param.ServerComputerName;

                CPApplication.Current.ServerIPAddress = param.ServerIPAddress;

                CPApplication.Current.GlobalRegionName = param.GlobalRegion;

                CPApplication.Current.LocalRegionName = param.LocalRegion;

                CPApplication.Current.DefaultPage = param.DefaultPage;

                CPApplication.Current.PortalBaseAddress = param.HostAddress;

                CPApplication.Current.FrameworkXapName = param.FrameworkXapName;

                CPApplication.Current.ClientIPAddress = param.ClientIPAddress;

                CPApplication.Current.ClientComputerName = param.ClientComputerName;

                if (callback != null)
                {
                    callback();
                }
            };
            client.GetAppParamsAsync();
        }
コード例 #2
0
        public XapVersionController()
        {
            XapVersionList        = new List <XapVersion>();
            AutoCheckIntervalTime = new TimeSpan(0, 5, 0);
            EnableAutoCheck       = true;

            m_ServiceClient = new CommonServiceV40Client();
            m_ServiceClient.CheckAppVersionCompleted += new EventHandler <CheckAppVersionCompletedEventArgs>(m_ServiceClient_CheckAppVersionCompleted);
        }
コード例 #3
0
        public GlobalOptions()
        {
            InitializeComponent();

            Loaded += new RoutedEventHandler(GlobalOptions_Loaded);

            GridGlobalOptions.MouseEnter += new MouseEventHandler(Menu_MouseEnter);
            GridGlobalOptions.MouseLeave += new MouseEventHandler(Menu_MouseLeave);

            GridPopGlobalOptions.MouseEnter += new MouseEventHandler(Menu_MouseEnter);
            GridPopGlobalOptions.MouseLeave += new MouseEventHandler(Menu_MouseLeave);

            ListItemLanguage.MouseEnter += new MouseEventHandler(LanguageOptions_MouseEnter);
            ListItemLanguage.MouseLeave += new MouseEventHandler(LanguageOptions_MouseLeave);

            GridPopLanguageOptions.MouseEnter += new MouseEventHandler(LanguageOptions_MouseEnter);
            GridPopLanguageOptions.MouseLeave += new MouseEventHandler(LanguageOptions_MouseLeave);

            ListBoxLanguage.SelectionChanged += new SelectionChangedEventHandler(ListBoxLanguage_SelectionChanged);
            this.m_serviceClient              = new CommonServiceV40Client();
            this.m_serviceClient.CheckAppVersionCompleted += new System.EventHandler <CheckAppVersionCompletedEventArgs>(m_serviceClient_CheckAppVersionCompleted);
        }
コード例 #4
0
        private void ProcessWhenCompleted(CheckAndDownloadUpdateCompletedEventArgs e)
        {
            //如果有某个应用程序更新可用,但是使用了用户尚未安装的 Silverlight 的新版本,将不下载更新。在此情况下,UpdateAvailable 属性值为 false,并且 Error 属性值为 PlatformNotSupportedException 实例。
            //出现这种情况时,您可以提醒用户打开应用程序的宿主网站,触发基于 HTML 的 Silverlight 升级体验。
            if (e.Error != null &&
                e.Error is PlatformNotSupportedException)
            {
                MessageBox.Show("An application update is available, " +
                                "but it requires a new version of Silverlight. " +
                                "Visit the application home page to upgrade.");

                return;
            }

            XapVersionInfo xapVersionInfo;
            var            client = new CommonServiceV40Client();

            client.GetFrameworkVersionAsync();
            client.GetFrameworkVersionCompleted += (obj, args) =>
            {
                if (args.Error != null)
                {
                    throw args.Error;
                }
                if (args.Result.Faults != null && args.Result.Faults.Count > 0)
                {
                    throw new Exception(args.Result.Faults[0].ErrorDetail);
                }

                if (args.Result.Body != null)
                {
                    xapVersionInfo = ToXapVersionInfo(args.Result.Body);

                    if (e.UpdateAvailable)
                    {
                        var version = UtilityHelper.GetIsolatedStorage(Constants.Key_Framework_Version);

                        if (string.IsNullOrEmpty(version))
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                var box = new UpdateWindow(xapVersionInfo);
                                box.ShowWindow();
                            });
                        }
                        else if (!xapVersionInfo.Version.Equals(version, StringComparison.OrdinalIgnoreCase))
                        {
                            xapVersionInfo.PreVersion = version;

                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                var box = new UpdateWindow(xapVersionInfo);
                                box.ShowWindow();
                            });
                        }
                    }

                    UtilityHelper.SetIsolatedStorage(Constants.Key_Framework_Version, xapVersionInfo.Version);
                }
            };
        }