Exemple #1
0
        public static void analiz_closing_thread(PING p, PING_prepare prep)
        {
            if (p != null)
            {
                p.stop();
            }
            if (prep != null)
            {
                prep.stop();

                byte ct = 0;
                while (!prep.stateTASKisCanceled())
                {
                    ct++;
                    if (ct == 5)
                    {
                        Wait.Create("Ждите идет прерывание пинга", false);
                        LongtaskPingCANCELING.enable(p, prep);
                        break;
                    }
                    Thread.Sleep(100);
                }
            }

            stop();
        }
Exemple #2
0
 public static void stop()
 {
     _ping         = null;
     _ping_prepare = null;
     en            = false;
     Wait.Close();
 }
Exemple #3
0
        //примеры отмены задачи
        // cancellationToken.ThrowIfCancellationRequested();
        //throw new OperationCanceledException(cancellationToken);
        //throw new OperationCanceledException();
        //throw new OperationCanceledException(CancellationToken.None);
        //throw new OperationCanceledException(new CancellationToken(true));
        //throw new OperationCanceledException(new CancellationToken(false));



        public AUTOPING(PING p, PING_prepare b)
        {
            _ping             = p;
            _pingPREPARE      = b;
            cts1              = new CancellationTokenSource();
            cancellationToken = cts1.Token;//для task1
        }
Exemple #4
0
 //============================== INIT ==================================
 public ViewModelWindow1(string lastText)
 {
     _ping        = null;
     _pingPREPARE = null;
     strPING      = "";
     CreateTimer2(500);
     loc.keyadd  = false;
     edit        = (ParamCanal)data.canal.Clone();
     key_PLAY    = new RelayCommand(PLAY);
     key_PING    = new RelayCommand(PING);
     key_SAVE    = new RelayCommand(SAVE);
     key_ADDBEST = new RelayCommand(BEST);
 }
Exemple #5
0
 void PING(object selectedItem)
 {
     if (lokpp)
     {
         return;
     }
     lokpp        = true;
     _ping        = new ViewModel.PING();
     _pingPREPARE = new PING_prepare(_ping);
     edit.ping    = "";
     if (edit.http == null)
     {
         return;
     }
     _pingPREPARE.Task_Completed += _pingPREPARE_Task_Completed;
     _pingPREPARE.asyncGET(edit.http);
 }
Exemple #6
0
        /// <summary>
        /// AUTO PING
        /// </summary>
        /// <param name="parameter"></param>
        async void key_AUTOPING(object parameter)
        {
            if (Wait.IsOpen)
            {
                return;
            }
            if (LongtaskPingCANCELING.isENABLE())
            {
                return;
            }
            if (myLISTbase == null)
            {
                return;
            }
            if (myLISTbase.Count == 0)
            {
                return;
            }
            if (winap != null)
            {
                return;
            }

            _ping        = new PING();
            _pingPREPARE = new PING_prepare(_ping);

            ap = new AUTOPING(_ping, _pingPREPARE);

            winap = new WindowPING
            {
                Title       = "АВТО ПИНГ",
                Topmost     = true,
                WindowStyle = WindowStyle.ThreeDBorderWindow,//WindowStyle.ToolWindow,
                Name        = "winPING"
            };

            winap.Closing += Ap_Closing;
            winap.Show();

            await ap.start();

            //winap.Owner = MainWindow.header;
        }
Exemple #7
0
 public static void enable(PING p, PING_prepare pp)
 {
     en            = true;
     _ping         = p;
     _ping_prepare = pp;
 }