コード例 #1
0
 internal void SetProgress(ulong Value)
 {
     if (ProgressUpdater != null)
     {
         UIContext.Post((s) => { ProgressUpdater.SetProgress(Value); }, null);
     }
 }
コード例 #2
0
 private void ModeSwitchSuccessWrapper()
 {
     IsSwitching = false;
     if ((UIContext == null) || (SynchronizationContext.Current == UIContext))
     {
         if (PhoneNotifier.CurrentInterface == null)
         {
             ModeSwitchErrorWrapper("Phone disconnected");
         }
         else
         {
             ModeSwitchSuccess((IDisposable)PhoneNotifier.CurrentModel, (PhoneInterfaces)PhoneNotifier.CurrentInterface);
         }
     }
     else
     {
         if (PhoneNotifier.CurrentInterface == null)
         {
             UIContext.Post(s => { ModeSwitchErrorWrapper("Phone disconnected"); }, null);
         }
         else
         {
             UIContext.Post(s => { ModeSwitchSuccess((IDisposable)PhoneNotifier.CurrentModel, (PhoneInterfaces)PhoneNotifier.CurrentInterface); }, null);
         }
     }
 }
コード例 #3
0
 private void Abort()
 {
     // SwitchModeViewModel must be created on the UI thread
     IsSwitchingInterface = false;
     UIContext.Post((t) =>
     {
         StorePaths();
         LogFile.Log("Aborting.");
         Exit();
     }, null);
 }
コード例 #4
0
 private void ModeSwitchErrorWrapper(string Message)
 {
     IsSwitching = false;
     if ((UIContext == null) || (SynchronizationContext.Current == UIContext))
     {
         ModeSwitchError(Message);
     }
     else
     {
         UIContext.Post(s => { ModeSwitchError(Message); }, null);
     }
 }
コード例 #5
0
 private void ModeSwitchProgressWrapper(string Message, string SubMessage)
 {
     if ((UIContext == null) || (SynchronizationContext.Current == UIContext))
     {
         ModeSwitchProgress(Message, SubMessage);
         SetWorkingStatus(Message, SubMessage);
     }
     else
     {
         UIContext.Post(s => {
             ModeSwitchProgress(Message, SubMessage);
             SetWorkingStatus(Message, SubMessage);
         }, null);
     }
 }
コード例 #6
0
        private void WaitForm_Shown(object sender, EventArgs e)
        {
            SetForegroundWindow(this.Handle);

            DateTime start        = DateTime.Now;
            bool     closeVisible = false;
            //延迟显示关闭按钮
            Task tsk = new Task(() =>
            {
                while (true)
                {
                    if (Disposing || IsDisposed)
                    {
                        return;
                    }
                    if (!closeVisible)
                    {
                        TimeSpan ts = DateTime.Now - start;
                        if (ts.TotalMilliseconds >= ShowCloseButtonDelay)
                        {
                            this.Invoke((MethodInvoker)(() =>
                            {
                                picClose.Visible = true;
                                closeVisible = true;
                            }));
                        }
                    }

                    var dic = GetUncloseControl?.Invoke();
                    if (dic == null || dic.Count == 0)
                    {
                        UIContext?.Post((o) =>
                        {
                            if (!Disposing && !IsDisposed)
                            {
                                this.Close();
                            }
                        }, null);
                        break;
                    }
                    Thread.Sleep(100);
                }
            });

            tsk.Start();
        }
コード例 #7
0
        private void SwitchToFlashMode()
        {
            // SwitchModeViewModel must be created on the UI thread
            IsSwitchingInterface = true;
            UIContext.Post(async(t) =>
            {
                LogFile.Log("Switching to Flash-mode");

                try
                {
                    await SwitchModeViewModel.SwitchToWithProgress(PhoneNotifier, PhoneInterfaces.Lumia_Flash,
                                                                   (msg, sub) =>
                                                                   ActivateSubContext(new BusyViewModel(msg, sub)));
                }
                catch (Exception Ex)
                {
                    ActivateSubContext(new MessageViewModel(Ex.Message, Callback));
                }
            }, null);
        }