Example #1
0
        private void LaunchInternetAccessManager(bool visible)
        {
            PleaseWait ApiWaiting = null;

            if (visible)
            {
                ApiWaiting = new PleaseWait();

                ApiWaiting.Title = CIV.strings.Dashboard_InternetAccessProgress;

                try
                {
                    // Si la fenêtre principale n'a jamais été affiché, une exception va être levée
                    ApiWaiting.Owner = this;
                }
                catch
                {
                    ApiWaiting.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                    ApiWaiting.Topmost = true;
                }

                ApiWaiting.Show();
            }

            ThreadStart start = delegate()
            {
                try
                {
                    InternetAccessUpdater internetAccessManager = new InternetAccessUpdater();
                    internetAccessManager.IsNotCompatibleClient = CentralCenterNotCompatible;
                    internetAccessManager.Execute(null, null);

                    Dispatcher.Invoke(DispatcherPriority.Background,
                                      new Action <bool, PleaseWait, Exception>(LaunchInternetAccessManager_callback),
                                      visible, ApiWaiting, null);
                }
                catch (Exception updateException)
                {
                    Dispatcher.Invoke(DispatcherPriority.Background,
                                      new Action <bool, PleaseWait, Exception>(LaunchInternetAccessManager_callback),
                                      visible, ApiWaiting, updateException);
                }
            };

            new System.Threading.Thread(start).Start();
        }
Example #2
0
        private void LaunchInternetAccessManager(bool visible)
        {
            PleaseWait ApiWaiting = null;

            if (visible)
            {
                ApiWaiting = new PleaseWait();

                ApiWaiting.Title = CIV.strings.Dashboard_InternetAccessProgress;

                try
                {
                    // Si la fenêtre principale n'a jamais été affiché, une exception va être levée
                    ApiWaiting.Owner = this;
                }
                catch
                {
                    ApiWaiting.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                    ApiWaiting.Topmost = true;
                }

                ApiWaiting.Show();
            }

            ThreadStart start = delegate()
            {
                try
                {
                    InternetAccessUpdater internetAccessManager = new InternetAccessUpdater();
                    internetAccessManager.IsNotCompatibleClient = CentralCenterNotCompatible;
                    internetAccessManager.Execute(null, null);

                    Dispatcher.Invoke(DispatcherPriority.Background,
                                       new Action<bool, PleaseWait, Exception>(LaunchInternetAccessManager_callback),
                                       visible, ApiWaiting, null);
                }
                catch (Exception updateException)
                {
                    Dispatcher.Invoke(DispatcherPriority.Background,
                                        new Action<bool, PleaseWait, Exception>(LaunchInternetAccessManager_callback),
                                        visible, ApiWaiting, updateException);
                }
            };

            new System.Threading.Thread(start).Start();
        }