예제 #1
0
        public DialogLatLong(IRenderer Renderer, CloseCallback CloseCallback, LatLongChange ChangeCallback, double Latitude, double Longitude, QSize ScreenSize, QPen ForePen, QPen BorderPen, QPen BackPen) : base(Renderer, ScreenSize, CloseCallback, ForePen, BorderPen, BackPen)
        {
            this.changeCallback = ChangeCallback;

            Latitude.ToComponents(out latDeg, out latMin, out latSec, out north);
            Longitude.ToComponents(out lngDeg, out lngMin, out lngSec, out east);
        }
예제 #2
0
        protected virtual void CloseFile()
        {
            //Prepare
            bool remove = true;

            //Check
            if (IsDirty)
            {
                //Get result
                MessageBoxResult result = MessageBox.Show($"Save changes to {DisplayName}?",
                                                          "Unsaved Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Information);

                //Handle
                switch (result)
                {
                case MessageBoxResult.Cancel:
                    remove = false;
                    break;

                case MessageBoxResult.Yes:
                    SaveToFile();
                    break;
                }
            }

            //Check and remove
            if (remove)
            {
                CloseCallback?.Invoke(this);
            }
        }
예제 #3
0
 internal WebSocketListener(ClientWebSocket wsConn, MessageCallback msgCallback, CloseCallback closeCallback)
 {
     this._ws          = wsConn;
     this._msgCb       = msgCallback;
     this._closeCb     = closeCallback;
     this.listenThread = new Thread(new ThreadStart(this.StartListeningForMessages));
     this.listenThread.Start();
 }
예제 #4
0
    //
    // Close the connection associated with the proxy and wait until the close completes.
    //
    private static void closeConnection(Ice.ObjectPrx prx)
    {
        CloseCallback cb = new CloseCallback();

        prx.ice_getConnection().setCloseCallback(cb.closed);
        prx.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait);
        cb.check();
    }
예제 #5
0
        public void ShowWindow(int diam, int rep, CloseCallback callBack = null)
        {
            this.diam           = diam;
            this.rep            = rep;
            this.closedCallback = callBack;

            OpenView();
        }
예제 #6
0
파일: AllTests.cs 프로젝트: summer1988/ice
    //
    // Close the connection associated with the proxy and wait until the close completes.
    //
    private static void closeConnection(Ice.ObjectPrx prx)
    {
        CloseCallback cb = new CloseCallback();

        prx.ice_getConnection().setCloseCallback(cb.closed);
        prx.ice_getConnection().close(false);
        cb.check();
    }
예제 #7
0
    //
    // Close the connection associated with the proxy and wait until the close completes.
    //
    private static void closeConnection(IObjectPrx prx)
    {
        CloseCallback cb = new CloseCallback();

        prx.GetConnection().SetCloseCallback(cb.closed);
        prx.GetConnection().Close(ConnectionClose.GracefullyWithWait);
        cb.check();
    }
        public async void PatientSelect(PatientUI patient)
        {
            await SelectCallback.InvokeAsync(patient);

            await CloseCallback.InvokeAsync(true);

            ShowDialog = false;
            StateHasChanged();
        }
예제 #9
0
        protected async Task HandleValidSubmit()
        {
            await PatientService.AddPatient(Patient);

            ShowDialog = false;

            await CloseCallback.InvokeAsync(true);

            StateHasChanged();
        }
예제 #10
0
파일: Dialog.cs 프로젝트: mch2112/solarmax
        protected Dialog(IRenderer Renderer, QSize ScreenSize, CloseCallback CloseCallback, QPen ForePen, QPen BorderPen, QPen BackPen)
        {
            this.renderer      = Renderer;
            this.screenSize    = ScreenSize;
            this.closeCallback = CloseCallback;
            this.forePen       = ForePen;
            this.borderPen     = BorderPen;
            this.backPen       = BackPen;

            SetupLayout();
        }
예제 #11
0
 /// <summary>
 ///
 /// </summary>
 public void CloseSafe()
 {
     if (this.InvokeRequired)
     {
         CloseCallback d = new CloseCallback(CloseSafe);
         Invoke(d);
     }
     else
     {
         Close();
     }
 }
예제 #12
0
 private void FormClose()
 {
     if (this.InvokeRequired)
     {
         CloseCallback d = new CloseCallback(FormClose);
         this.Invoke(d);
     }
     else
     {
         this.Close();
     }
 }
예제 #13
0
 private void CloseC()
 {
     if (this.InvokeRequired)
     {
         CloseCallback d = new CloseCallback(CloseC);
         this.Invoke(d, new object[] { });
     }
     else
     {
         this.Close();
     }
 }
예제 #14
0
 private void SafeClose()
 {
     if (this.statusLabel.InvokeRequired)
     {
         CloseCallback d = new CloseCallback(SafeClose);
         this.Invoke(d, new object[] {});
     }
     else
     {
         this.timer1.Enabled = false;
         this.Close();
     }
 }
예제 #15
0
 private void SafeClose()
 {
     if (this.statusLabel.InvokeRequired)
     {
         CloseCallback d = new CloseCallback(SafeClose);
         this.Invoke(d, new object[] {});
     }
     else
     {
         this.timer1.Enabled = false;
         this.Close();
     }
 }
예제 #16
0
    public void Close(CloseCallback callback)
    {
      if(IsOpen)
      {
        fTwain.Close();
        fWia.Close();
        fDataSources = null;
      }

      if(callback != null)
      {
        callback();
      }
    }
예제 #17
0
        public DialogDateTime(IRenderer Renderer, CloseCallback CloseCallback, DateTimeChange ChangeCallback, DateTime DateTime, bool UTC, QSize ScreenSize, QPen ForePen, QPen BorderPen, QPen BackPen)
            : base(Renderer, ScreenSize, CloseCallback, ForePen, BorderPen, BackPen)
        {
            this.changeCallback = ChangeCallback;

            date = DateTime;

            minDate = MathEx.Min(minDate, date.AddYears(-10));
            maxDate = MathEx.Max(maxDate, date.AddYears(10));

            this.utc = UTC;

            changeCallback(date);
        }
예제 #18
0
        /// <summary>
        /// Handles input signal (or error) from the RedRat3.
        /// </summary>
        public void SignalDataIn(object sender, EventArgs e)
        {
            if (e is SignalEventArgs)
            {
                sigInEvent = (SignalEventArgs)e;

                if (this.InvokeRequired)
                {
                    CloseCallback cb = new CloseCallback(this.Close);
                    this.Invoke(cb, null);
                }
                else
                {
                    this.Close();
                }
            }
        }
예제 #19
0
 public void CloseThread(ThreadData td)
 {
     if (InvokeRequired)//调用和创建该控件的线程是不同的线程,必须调用Invoke方法
     {
         if (closing)
         {
             return;
         }
         //创建该方法的委托实例
         CloseCallback d = new CloseCallback(CloseThread);
         //调用该委托实例,并传递参数,参数为object类型,使用this调用Invoke(this为当前窗体,是创建该窗体控件的线程)
         Invoke(d, new object[] { td });//this指定创建该控件的线程来Invoke(调用)
     }
     else//调用与创建该控件的线程是同一个线程
     {
         td.callBack(td);
     }
 }
예제 #20
0
 private void CloseForm()
 {
     if (pictureBox1.InvokeRequired)//调用和创建该控件的线程是不同的线程,必须调用Invoke方法
     {
         //创建该方法的委托实例
         CloseCallback d = new CloseCallback(CloseForm);
         //调用该委托实例,并传递参数,参数为object类型,使用this调用Invoke(this为当前窗体,是创建该窗体控件的线程)
         Invoke(d, new object[] { });//this指定创建该控件的线程来Invoke(调用)
     }
     else//调用与创建该控件的线程是同一个线程
     {
         if (pictureBox1.BackgroundImage != null)
         {
             pictureBox1.BackgroundImage.Dispose();
             pictureBox1.BackgroundImage = null;
         }
         Close();
     }
 }
예제 #21
0
        public static void Close(CloseCallback callback)
        {
            try
            {
                foreach (ILogger logger in Loggers)
                {
                    logger.Dispose();
                }

                Loggers.Clear();

                callback(true, null);
            }
            catch (Exception e)
            {
                if (callback != null)
                {
                    callback(false, e.Message);
                }
            }
        }
예제 #22
0
        /// <summary>
        /// Begins the close.
        /// </summary>
        /// <param name="callback">The callback.</param>
        /// <returns></returns>
        public IAsyncResult BeginClose(AsyncCallback callback)
        {
            CloseCallback ftpCallback = Close;

            return(ftpCallback.BeginInvoke(callback, null));
        }
예제 #23
0
 public void close() {
     CloseCallback d = new CloseCallback(this.Close);
     this.Invoke(d);
 }
예제 #24
0
 public override void OnPointerClick(PointerEventData eventData)
 {
     CloseCallback.SafeInvoke();
 }
예제 #25
0
 public override void Close(bool shouldCloseImmediately = false)
 {
     _shouldCloseImmediately = shouldCloseImmediately;
     CloseCallback.SafeInvoke();
 }
예제 #26
0
 public System.IAsyncResult BeginClose(  System.AsyncCallback callback )
 {
     CloseCallback ftpCallback = new CloseCallback( this.Close);
     return ftpCallback.BeginInvoke(callback, null);
 }
예제 #27
0
        /// <summary>
        /// Updates the UI every second.
        /// </summary>
        private void KeepUpdated()
        {
            while (waiting)
            {
                Program.CurrentPlayer             = Program.CurrentGame.LocalPlayers[0];
                Program.CurrentPlayer.NextCommand = "GAMEUPDATE";
                Program.CurrentPlayer.NewCommand  = true;
                while (!Program.CurrentPlayer.NewResponse)
                {
                    Application.DoEvents();
                }
                string[] response = Program.CurrentPlayer.LastResponse.Split(' ');
                Program.CurrentPlayer.NewResponse = false;
                switch (response[0])
                {
                case "WAITING":
                    Program.CurrentGame.Stage = 'W';
                    break;

                case "PLAYING":
                    Program.CurrentGame.Stage = 'P';
                    break;

                case "VOTING":
                    Program.CurrentGame.Stage = 'V';
                    break;

                case "END":
                    Program.CurrentGame.Stage = 'E';
                    break;

                default:
                    MessageBox.Show("Unexpected Error! Unknown Game State, Application will exit!", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    Program.Exit();
                    break;
                }

                switch (Program.CurrentGame.Stage)
                {
                case 'W':
                    Update("Waiting for other players to join the game...");
                    break;

                case 'P':
                    foreach (ClientNetworking player in Program.CurrentGame.LocalPlayers)
                    {
                        Program.CurrentPlayer             = player;
                        Program.CurrentPlayer.NextCommand = "NEED ANSWER";
                        Program.CurrentPlayer.NewCommand  = true;
                        while (!Program.CurrentPlayer.NewResponse)
                        {
                            Application.DoEvents();
                        }
                        string[] responseP = Program.CurrentPlayer.LastResponse.Split(' ');
                        Program.CurrentPlayer.NewResponse = false;
                        switch (responseP[0])
                        {
                        case "YES":
                            waiting = false;
                            break;

                        case "NO":
                            break;

                        default:
                            MessageBox.Show("Unexpected Error! Unknown NEED ANSWER Response, Application will exit!", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            Program.Exit();
                            break;
                        }
                    }
                    Update("Waiting for other players to submit their answers...");
                    break;

                case 'V':
                    foreach (ClientNetworking player in Program.CurrentGame.LocalPlayers)
                    {
                        Program.CurrentPlayer             = player;
                        Program.CurrentPlayer.NextCommand = "NEED VOTE";
                        Program.CurrentPlayer.NewCommand  = true;
                        while (!Program.CurrentPlayer.NewResponse)
                        {
                            Application.DoEvents();
                        }
                        string[] responseP = Program.CurrentPlayer.LastResponse.Split(' ');
                        Program.CurrentPlayer.NewResponse = false;
                        switch (responseP[0])
                        {
                        case "YES":
                            waiting = false;
                            break;

                        case "NO":
                            break;

                        default:
                            MessageBox.Show("Unexpected Error! Unknown NEED VOTE Response, Application will exit!", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            Program.Exit();
                            break;
                        }
                    }
                    Update("Waiting for other players to submit their votes...");
                    break;

                default:
                    waiting = false;
                    return;
                }
                Thread.Sleep(1000);
            }
            CloseCallback d = new CloseCallback(Close);

            this.Invoke(d, new object[] { });
            return;
        }
예제 #28
0
 public virtual void Close()
 {
     CloseCallback?.Invoke();
 }
예제 #29
0
 static extern void GLUT_RegisterClose(CloseCallback tickCallback);
		public CloseState(CloseCallback callback, object state){
			this.callback = callback;
			this.state = state;
		}
	public ThreadQueue.TaskControl Close(CloseCallback callback, object state)
	{
		return ThreadQueue.QueueUserWorkItem(new ThreadQueue.WorkCallback(CloseDatabase), new WaitCallback(CloseDatabaseComplete), new CloseState(callback,state));
	}
예제 #32
0
 public ThreadQueue.TaskControl Close(CloseCallback callback, object state)
 {
     return(ThreadQueue.QueueUserWorkItem(new ThreadQueue.WorkCallback(CloseDatabase), new WaitCallback(CloseDatabaseComplete), new CloseState(callback, state)));
 }
예제 #33
0
파일: Glut.cs 프로젝트: WolfgangSt/axiom
 /// <summary>
 ///     Sets the close callback.
 /// </summary>
 /// <param name="func">
 ///     The new close callback function.  See <see cref="CloseCallback" />.
 /// </param>
 public static void glutCloseFunc([In] CloseCallback func) {
     closeCallback = func;
     __glutCloseFunc(closeCallback);
 }
예제 #34
0
파일: Glut.cs 프로젝트: WolfgangSt/axiom
 private static extern void __glutCloseFunc(CloseCallback func);
예제 #35
0
        public System.IAsyncResult BeginClose(System.AsyncCallback callback)
        {
            CloseCallback ftpCallback = new CloseCallback(this.Close);

            return(ftpCallback.BeginInvoke(callback, null));
        }
예제 #36
0
 public void setCloseCallback(CloseCallback callback)
 {
     lock(this)
     {
         if(_state >= StateClosed)
         {
             if(callback != null)
             {
                 _threadPool.dispatch(() =>
                 {
                     try
                     {
                         callback(this);
                     }
                     catch(System.Exception ex)
                     {
                         _logger.error("connection callback exception:\n" + ex + '\n' + _desc);
                     }
                 } , this);
             }
         }
         else
         {
             _closeCallback = callback;
         }
     }
 }
예제 #37
0
 public void OnClose(CloseCallback callback)
 {
     this.close_callback = callback;
 }
예제 #38
0
        public void Stop()
        {
            CloseCallback c = new CloseCallback(InternalClose);

            this.Invoke(c);
        }
예제 #39
0
파일: AllTests.cs 프로젝트: Crysty-Yui/ice
 //
 // Close the connection associated with the proxy and wait until the close completes.
 //
 private static void closeConnection(Ice.ObjectPrx prx)
 {
     CloseCallback cb = new CloseCallback();
     prx.ice_getConnection().setCloseCallback(cb.closed);
     prx.ice_getConnection().close(false);
     cb.check();
 }
예제 #40
0
 public CloseState(CloseCallback callback, object state)
 {
     this.callback = callback;
     this.state    = state;
 }
예제 #41
0
        public void close()
        {
            CloseCallback d = new CloseCallback(this.Close);

            this.Invoke(d);
        }