Example #1
0
        private void ClearMap()
        {
            if (gMapControl1.InvokeRequired)
            {
                var Callback = new ClearCallback(ClearMap);

                Invoke(Callback);
            }
            else
            {
                try
                {
                    Pokemons.Clear();

                    var Overlay = gMapControl1.Overlays.FirstOrDefault();

                    if (Overlay != null)
                    {
                        var Player = Overlay.Markers.FirstOrDefault();

                        Overlay.Markers.Clear();

                        Overlay.Markers.Add(Player);
                    }
                }
                catch { }
            }
        }
Example #2
0
 private void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Data))
     {
         if (status == 0)
         {
             if (e.Data.IndexOf("所有用户配置文件 : ") >= 0)
             {
                 AppendText(e.Data.Substring(15, e.Data.Length - 15));
             }
         }
         if (status == 1)
         {
             if (e.Data.IndexOf("安全密钥               : 不存在") >= 0)
             {
                 MessageBox.Show("该网络无密码...");
             }
             if (e.Data.IndexOf("    关键内容            : ") >= 0)
             {
                 MessageBox.Show("该网络密码为:" + e.Data.Substring(22, e.Data.Length - 22));
                 status = -1;
             }
         }
         if (status == 2)
         {
             MessageBox.Show(e.Data);
             ClearCallback d = new ClearCallback(RefreshList);
             this.listBox1.Invoke(d);
         }
         if (status == 3)
         {
             MessageBox.Show(e.Data);
         }
     }
 }
 /// <summary>
 /// Initializes a new instance of <see cref="TextReaderWriterConsole" /> class.
 /// </summary>
 /// <param name="reader">The reader to use.</param>
 /// <param name="writerProvider">The logic to provides the <see cref="TextWriter" /> for write operations.</param>
 /// <param name="clearCallback">The optional logic for <see cref="TextReaderWriterConsole.OnClear()" /> method.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="reader" /> and/or <paramref name="writerProvider" /> are <see langword="null" />.
 /// </exception>
 public TextReaderWriterConsole(TextReader reader,
                                TextWriterProvider writerProvider,
                                ClearCallback clearCallback)
     : this(reader,
            writerProvider, (TextWriterUsedCallback)null,
            clearCallback)
 {
 }
 public void Clear()
 {
     if (listbox_.InvokeRequired)
     {
         ClearCallback d = new ClearCallback(this.Clear);
         listbox_.BeginInvoke(d, null);
     }
     else
     {
         listbox_.Items.Clear();
     }
 }
Example #5
0
 public void Clear()
 {
     if (this.InvokeRequired)
     {
         ClearCallback d = new ClearCallback(Clear);
         this.Invoke(d, new object[] { });
     }
     else
     {
         this.Items.Clear();
     }
 }
 public void Clear()
 {
     if (TextBox.InvokeRequired)
     {
         ClearCallback callback = Clear;
         TextBox.Invoke(callback, null);
     }
     else
     {
         TextBox.Text = string.Empty;
     }
 }
 public void Clear()
 {
     if (listbox_.InvokeRequired)
     {
         ClearCallback d = new ClearCallback(this.Clear);
         listbox_.BeginInvoke(d, null);
     }
     else
     {
         listbox_.Items.Clear();
     }
 }
Example #8
0
 private void Clear()
 {
     if (InvokeRequired)
     {
         ClearCallback callback = Clear;
         Invoke(callback);
     }
     else
     {
         detailsListView.Clear();
     }
 }
Example #9
0
 private void ClearErr()
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.errorBox.InvokeRequired)
     {
         ClearCallback d = new ClearCallback(ClearErr);
         this.Invoke(d, new object[] { });
     }
     else
     {
         this.errorBox.Clear();
     }
 }
 private void ClearDataGridView(DataGridView dgv)
 {
     if (_resultWindow.Controls["pnlRooms"].Controls[dgv.Name].InvokeRequired)
     {
         ClearCallback d = new ClearCallback(ClearDataGridView);
         _resultWindow.Controls["pnlRooms"].Invoke(d, new object[] { dgv });
     }
     else
     {
         dgv.Rows.Clear();
         for (int i = 9; i < 18; i++)
         {
             dgv.Rows.Add(string.Format(CultureInfo.CurrentCulture, "{0} - {1}", i, (i + 1)));
         }
     }
 }
Example #11
0
 internal void ClearLog()
 {
     if (InvokeRequired)
     {
         ClearCallback callback = new ClearCallback(ClearLog);
         try
         {
             Invoke(callback);
         }
         catch (Exception)
         {
         }
     }
     else
     {
         Clear();
     }
 }
 /// <summary>
 /// This method demonstrates a pattern for making thread-safe
 /// calls on a Windows Forms control.
 /// If the calling thread is different from the thread that
 /// created the DataGridView control, this method creates a
 /// ClearCallback and calls itself asynchronously using the
 /// Invoke method.
 /// If the calling thread is the same as the thread that created
 /// the DataGridView control, the Object is set directly.
 /// </summary>
 /// <param name="text"></param>
 private void ClearDataGridView(DataGridView dgv)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (_resultWindow.Controls["panelRoomDGV"].Controls[dgv.Name].InvokeRequired)
     {
         ClearCallback d = new ClearCallback(ClearDataGridView);
         _resultWindow.Controls["panelRoomDGV"].Invoke(d, new object[] { dgv });
     }
     else
     {
         dgv.Rows.Clear();
         //
         // Add TimeSlots Data
         //
         for (int i = 8; i < 20; i++)
         {
             dgv.Rows.Add(string.Format(CultureInfo.CurrentCulture, "{0} - {1}", i, (i + 1)));
         }
     }
 }
Example #13
0
        private void populateTextBox(List <MainWindows.MainWindow> mws)
        {
            Console.WriteLine("populateWindowsGridListView " + mws.Count);

            if (this.textBox2.InvokeRequired)
            {
                ClearCallback d = new ClearCallback(clearTextBoxText);
                this.Invoke(d, new object[] {  });
            }
            else
            {
                clearTextBoxText();
            }

            foreach (MainWindows.MainWindow amw in mws)
            {
                if (this.textBox2.InvokeRequired)
                {
                    SetTextCallback d = new SetTextCallback(setTextBoxText);
                    this.Invoke(d, new object[] { amw });
                }
                else
                {
                    setTextBoxText(amw);
                }
            }

            if (this.textBox3.InvokeRequired)
            {
                SetTextCallbackCount d = new SetTextCallbackCount(setTextBox3Text);
                this.Invoke(d, new object[] { mws.Count });
            }
            else
            {
                setTextBox3Text(mws.Count);
            }
        }
        /// <summary>
        /// Initializes a new instance of <see cref="TextReaderWriterConsole" /> class.
        /// </summary>
        /// <param name="readerProvider">The logic to provides the <see cref="TextReader" /> for read operations.</param>
        /// <param name="readerUsedCallback">
        /// The optional logic that is invoked AFTER provided <see cref="TextReader" /> has been used.
        /// </param>
        /// <param name="writerProvider">The logic to provides the <see cref="TextWriter" /> for write operations.</param>
        /// <param name="writerUsedCallback">
        /// The optional logic that is invoked AFTER provided <see cref="TextWriter" /> has been used.
        /// </param>
        /// <param name="clearCallback">The optional logic for <see cref="TextReaderWriterConsole.OnClear()" /> method.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="readerProvider" /> and/or <paramref name="writerProvider" /> are <see langword="null" />.
        /// </exception>
        public TextReaderWriterConsole(TextReaderProvider readerProvider,
                                       TextReaderUsedCallback readerUsedCallback,
                                       TextWriterProvider writerProvider,
                                       TextWriterUsedCallback writerUsedCallback,
                                       ClearCallback clearCallback)
        {
            if (readerProvider == null)
            {
                throw new ArgumentNullException("readerProvider");
            }

            if (writerProvider == null)
            {
                throw new ArgumentNullException("writerProvider");
            }

            this._READER_PROVIDER      = readerProvider;
            this._READER_USED_CALLBACK = readerUsedCallback;

            this._WRITER_PROVIDER      = writerProvider;
            this._WRITER_USED_CALLBACK = writerUsedCallback;

            this._CLEAR_CALLBACK = clearCallback;
        }
		/// <summary>
		/// Limpa a lista.
		/// </summary>
		public override void Clear()
		{
			if (listaPessoas.InvokeRequired)
			{
				ClearCallback método = new ClearCallback(Clear);
				listaPessoas.BeginInvoke(método);
			}
			else
			{
				foreach (ListaPessoasItem item in this)
				{
					listaPessoas.Controls.Remove(item);
					DestratarEventos(item);
				}

				base.Clear();

				listaPessoas.Reorganizar();
			}
		}
Example #16
0
		private void ClearErr() {
			// InvokeRequired required compares the thread ID of the
			// calling thread to the thread ID of the creating thread.
			// If these threads are different, it returns true.
			if (this.errorBox.InvokeRequired) {
				ClearCallback d = new ClearCallback(ClearErr);
				this.Invoke(d, new object[] { });
			} else {
				this.errorBox.Clear();
			}
		}
 /// <summary>
 /// This method demonstrates a pattern for making thread-safe
 /// calls on a Windows Forms control. 
 /// If the calling thread is different from the thread that
 /// created the DataGridView control, this method creates a
 /// ClearCallback and calls itself asynchronously using the
 /// Invoke method.
 /// If the calling thread is the same as the thread that created
 /// the DataGridView control, the Object is set directly. 
 /// </summary>
 /// <param name="text"></param>
 private void ClearDataGridView(DataGridView dgv)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (_resultWindow.Controls["panelRoomDGV"].Controls[dgv.Name].InvokeRequired)
     {
         ClearCallback d = new ClearCallback(ClearDataGridView);
         _resultWindow.Controls["panelRoomDGV"].Invoke(d, new object[] { dgv });
     }
     else
     {
         dgv.Rows.Clear();
         //
         // Add TimeSlots Data
         //
         for (int i = 8; i < 20; i++)
         {
             dgv.Rows.Add(string.Format(CultureInfo.CurrentCulture, "{0} - {1}", i, (i + 1)));
         }
     }
 }
Example #18
0
 public void Clear()
 {
     ClearCallback?.Invoke();
 }
        public DatasmithRevitExportMessages(ClearCallback InCallback)
        {
            OnClear = InCallback;

            MessageBox             = new TextBox();
            MessageBox.Name        = "MessageBox";
            MessageBox.AutoSize    = true;
            MessageBox.BorderStyle = BorderStyle.FixedSingle;
            MessageBox.Dock        = DockStyle.Fill;
            MessageBox.ReadOnly    = true;
            MessageBox.Multiline   = true;
            MessageBox.ScrollBars  = System.Windows.Forms.ScrollBars.Vertical;
            MessageBox.TabIndex    = 0;
            MessageBox.WordWrap    = true;

            Button ClearButton = new Button();

            ClearButton.Name     = "ClearButton";
            ClearButton.Text     = "Clear";
            ClearButton.Anchor   = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left)));;
            ClearButton.Margin   = new Padding(3, 3, 3, 3);
            ClearButton.Size     = new Size(75, 23);
            ClearButton.TabIndex = 1;
            ClearButton.UseVisualStyleBackColor = true;
            ClearButton.Click += new EventHandler(ClearButtonClicked);

            Button CloseButton = new Button();

            CloseButton.Name                    = "CloseButton";
            CloseButton.Text                    = "Close";
            CloseButton.Anchor                  = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));;
            CloseButton.DialogResult            = DialogResult.OK;
            CloseButton.Margin                  = new Padding(3, 3, 3, 3);
            CloseButton.Size                    = new Size(75, 23);
            CloseButton.TabIndex                = 2;
            CloseButton.UseVisualStyleBackColor = true;
            CloseButton.Click                  += new EventHandler(CloseButtonClicked);

            TableLayoutPanel DialogLayout = new TableLayoutPanel();

            DialogLayout.Name        = "DialogLayout";
            DialogLayout.ColumnCount = 2;
            DialogLayout.ColumnStyles.Add(new ColumnStyle());
            DialogLayout.ColumnStyles.Add(new ColumnStyle());
            DialogLayout.RowCount = 2;
            DialogLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
            DialogLayout.RowStyles.Add(new RowStyle());
            DialogLayout.Dock     = DockStyle.Fill;
            DialogLayout.Location = new Point(10, 10);
            DialogLayout.TabIndex = 3;

            DialogLayout.Controls.Add(MessageBox, 0, 0);
            DialogLayout.Controls.Add(ClearButton, 0, 1);
            DialogLayout.Controls.Add(CloseButton, 1, 1);

            DialogLayout.SetColumnSpan(MessageBox, 2);

            Name = "UnrealDatasmithExportMessages";
            Text = "Unreal Datasmith Export - Messages";
            AutoScaleDimensions = new SizeF(12F, 25F);
            AutoScaleMode       = AutoScaleMode.Font;
            ClientSize          = new Size(1200, 300);
            Padding             = new Padding(10);
            ShowIcon            = false;
            SizeGripStyle       = SizeGripStyle.Show;
            StartPosition       = FormStartPosition.CenterParent;

            Controls.Add(DialogLayout);
        }