public static void SetStatusText(String text)
 {
     if (main != null)
     {
         SetStatusCallback d = new SetStatusCallback(main.SetStatusTextCB);
         main.Invoke(d, new object[] { text });
     }
 }
Exemple #2
0
 private void Set_StatusBox(TextBox tb, string text, Color color)
 {
     if (tb.InvokeRequired)
     {
         SetStatusCallback s = new SetStatusCallback(Set_StatusBox);
         this.Invoke(s, new object[] { tb, text, color });
     }
     else
     {
         tb.Text      = text;
         tb.BackColor = color;
     }
 }
Exemple #3
0
 private void SetStatus(string Status, Color LabelColor)
 {
     if (this.label1.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { Status, LabelColor });
     }
     else
     {
         this.label1.ForeColor = LabelColor;
         this.label1.Text      = Status;
     }
 }
Exemple #4
0
 /// <summary>
 /// Refreshes the view.
 /// </summary>
 /// <param name="status">The status.</param>
 /// <param name="url">The URL.</param>
 private void RefreshView(string status, string url)
 {
     if (txtStatus.InvokeRequired)
     {
         SetStatusCallback callback = new SetStatusCallback(RefreshView);
         this.Invoke(callback, status, url);
     }
     else
     {
         txtStatus.Text = status;
         lnkURL.Text    = url;
     }
 }
 internal void SetStatus(int row, string status, string info)
 {
     if (GetLabelByIndex(_colStatus, row).InvokeRequired || GetLabelByIndex(_colInfo, row).InvokeRequired)  // if the call is coming from a different thread, use Invoke to make this thread-safe
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { row, status, info });
     }
     else
     {
         GetLabelByIndex(_colStatus, row).Text = status;
         GetLabelByIndex(_colInfo, row).Text   = info;
     }
 }
 private void BroadCastErrorEventHandler(object sender, MessageEventArgs me)
 {
     if (labelStatus.InvokeRequired)
     {
         SetStatusCallback callback = new SetStatusCallback(BroadCastErrorEventHandler);
         this.Invoke(callback, this, me);
     }
     else
     {
         labelStatus.ForeColor = Color.Red;
         labelStatus.Text      = me.Message;
     }
 }
Exemple #7
0
 private void setStatus(string text, Color color, int process)
 {
     if (this.statusStrip.InvokeRequired)
     {
         SetStatusCallback d1 = new SetStatusCallback(setStatus);
         this.Invoke(d1, new object[] { text, color, process });
     }
     else
     {
         toolStripProgressBar.Value     = process;
         toolStripStatusLabel.Text      = text;
         toolStripStatusLabel.BackColor = color;
     }
 }
Exemple #8
0
 public void SetStatus(string statusMessage, int progress)
 {
     if (labelStatus.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         Invoke(d, new object[] { statusMessage, progress });
     }
     else
     {
         labelStatus.Text   = statusMessage;
         progressBar1.Value = progress;
         ShowMe();
     }
 }
Exemple #9
0
 /// <summary>
 /// Set the status label to the specified value using
 /// a thread safe method.
 /// </summary>
 /// <param name="text">The text value to set</param>
 private void SetStatus(string text)
 {
     // Check to see if we need to invoke the callback or if
     // we can set the value directly
     if (this.labelFilesRemaining.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         this.labelFilesRemaining.Text = text;
     }
 }
 private void SetStatus(String statusText)
 {
     if (this.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { statusText });
     }
     else
     {
         if (this.mStatusStrip != null)
         {
             this.mStatusStrip.Text = statusText;
         }
     }
 }
Exemple #11
0
 public void SetStatus(string text)
 {
     // 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.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         this.serverStatus.Text = text;
     }
 }
 // This method is passed in to the SetTextCallBack delegate
 // to set the Text property of textBox1.
 private void SetStatus(string text)
 {
     // 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 (lblStatus.InvokeRequired)
     {
         var d = new SetStatusCallback(SetStatus);
         Invoke(d, new object[] { text });
     }
     else
     {
         lblStatus.Text = text;
         lblStatus.Update();
     }
 }
        private void SetStatus(StringBuilder XmlStatus)
        {
            try
            {
                // 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 (LblStatus.InvokeRequired)
                {
                    SetStatusCallback d = new SetStatusCallback(SetStatus);
                    LblStatus.Invoke(d, XmlStatus);
                }
                else
                {
                    //if(!VarGlobal.LessVerbose)Console.WriteLine(XmlStatus.ToString());
                    List <string> Result = ReadXml.GetValue(XmlStatus.ToString(), "status", "code");
                    if (Result.Count > 0)
                    {
                        string        Res    = Result[0];
                        List <string> Detail = ReadXml.GetValue(XmlStatus.ToString(), "status", "details");
                        if (Detail.Count > 0)
                        {
                            Res += " " + Detail[0];
                        }


                        LblStatus.Text = Res;
                        if (Res.IndexOf("succeeded", StringComparison.InvariantCultureIgnoreCase) > -1)
                        {
                            LblStatus.ForeColor = Color.Green;
                        }
                        if (Res.IndexOf("failed", StringComparison.InvariantCultureIgnoreCase) > -1)
                        {
                            LblStatus.ForeColor = Color.Red;
                        }
                    }
                    backgroundWorkerBuildStatus.RunWorkerAsync("FsList");
                }
            }
            catch (Exception Ex)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine(Ex.Message + Environment.NewLine + Ex.StackTrace);
                }
            }
        }
Exemple #14
0
        public void AddStatusText(String value)
        {
            if (this.StatusListBox.InvokeRequired)
            {
                SetStatusCallback d = new SetStatusCallback(AddStatusText);
                this.Invoke(d, new object[] { value });
            }
            else
            {
                if (Counter > 255)
                {
                    Counter = 0;
                    this.StatusListBox.Items.Clear();
                }

                Counter++;

                this.StatusListBox.Items.Add(value);
                this.StatusListBox.SelectedIndex = this.StatusListBox.Items.Count - 1;
            }
        }
Exemple #15
0
 public void Set2ndImage(string i)
 {
     if (this.livestream.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(Set2ndImage);
         if (!this.IsDisposed)
         {
             this.Invoke(d, new object[] { i });
         }
     }
     else
     {
         try
         {
             this.livestream.ImageLocation = i;
         }
         catch (Exception ex)
         {
             System.Windows.Forms.MessageBox.Show("SetXY Error " + ex.ToString());
         }
     }
 }
Exemple #16
0
 private void isActive(bool status)
 {
     if (lblConnectionStatus.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(isActive);
         this.Invoke(d, new object[] { status });
     }
     else
     {
         if (status)
         {
             lblConnectionStatus.ForeColor = System.Drawing.Color.Green;
             lblConnectionStatus.Text      = "CONNECTED";
         }
         else
         {
             lblConnectionStatus.ForeColor = System.Drawing.Color.Red;
             lblConnectionStatus.Text      = "DISCONNECTED";
             destroyThread();
         }
     }
 }
Exemple #17
0
        private void Print_Load(object sender, EventArgs e)
        {
            setTextCallback   = new SetTextCallback(SetText);
            setStatusCallback = new SetStatusCallback(SetStatus);

            timerRunner.AutoReset = false;               //每到指定时间Elapsed事件是触发一次(false),还是一直触发(true)
            timerRunner.Interval  = timerRunnerInterval; // 设置时间间隔
            timerRunner.Elapsed  += new System.Timers.ElapsedEventHandler(InvokeMsg);

            Printer.bill.PrintCore printCore = new bill.PrintCore();
            string text = printCore.findPrt();

            this.Invoke(setStatusCallback, new object[] { text });
            if (text.IndexOf("查不到名称") < 0)
            {
                timerRunner.Start();
                toolStripBtnStatus.Text = "服务已开始";
            }
            else
            {
                toolStripBtnStatus.Text = "服务已停止";
            }
        }
Exemple #18
0
 private void Set_StatusBox(TextBox tb, string text, Color color)
 {
     if (tb.InvokeRequired)
     {
         SetStatusCallback s = new SetStatusCallback(Set_StatusBox);
         this.Invoke(s, new object[] { tb, text,color });
     }
     else
     {
         tb.Text = text;
         tb.BackColor = color;
     }
 }
Exemple #19
0
 private void setStatus(string text, Color color, int process)
 {
     if (this.statusStrip.InvokeRequired)
     {
         SetStatusCallback d1 = new SetStatusCallback(setStatus);
         this.Invoke(d1, new object[] { text, color, process });
     }
     else
     {
         toolStripProgressBar.Value = process;
         toolStripStatusLabel.Text = text;
         toolStripStatusLabel.BackColor = color;
     }
 }
 /// <summary>
 /// Updates a user's Facebook status.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Users.SetStatusAsync("I'm an async code sample.", true, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="status">The status message to set.  Note: The maximum message length is 255 characters; messages longer than that limit will be truncated and appended with '...'.</param>
 /// <param name="status_includes_verb">If set to true, the word "is" will not be prepended to the status message.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>This method returns true on success, false on failure, or an error code.</returns>
 public bool SetStatusAsync(string status, bool status_includes_verb, SetStatusCallback callback, Object state)
 {
     return SetStatusAsync(status, status_includes_verb, 0, callback, state);
 }
 /// <summary>
 /// Updates a user's Facebook status.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Users.SetStatusAsync("I'm an async code sample.", true, Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="status">The status message to set.  Note: The maximum message length is 255 characters; messages longer than that limit will be truncated and appended with '...'.</param>
 /// <param name="status_includes_verb">If set to true, the word "is" will not be prepended to the status message.</param>
 /// <param name="uid">The user ID of the user whose status you are setting. If this parameter is not specified, then it defaults to the session user.  Note: This parameter applies only to Web applications.  Facebook ignores this parameter if it is passed by a desktop application.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>This method returns true on success, false on failure, or an error code.</returns>
 public bool SetStatusAsync(string status, bool status_includes_verb, long uid, SetStatusCallback callback, Object state)
 {
     return SetStatus(status, status_includes_verb, uid, true, callback, state);
 }
        private bool SetStatus(string status, bool status_includes_verb, long uid, bool isAsync, SetStatusCallback callback, Object state)
        {
            var parameterList = new Dictionary<string, string>
                                    {
                                        {"method", "facebook.users.setStatus"},
                                        {"status", status},
                                        {"status_includes_verb", status_includes_verb.ToString()}
                                    };
            Utilities.AddOptionalParameter(parameterList, "uid", uid);

            if (isAsync)
            {
                SendRequestAsync<users_setStatus_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<bool>(callback), state);
                return true;
            }

            var response = SendRequest<users_setStatus_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));
            return response == null ? true : response.TypedValue;
        }
Exemple #23
0
 private void SetStatus(string Status, Color LabelColor)
 {
     if (this.label1.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { Status, LabelColor });
     }
     else
     {
         this.label1.ForeColor = LabelColor;
         this.label1.Text = Status;
     }
 }
Exemple #24
0
 private void NastavStatus(string Text)
 {
     if(Status.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(NastavStatus);
         this.Invoke(d, new object[] { Text });
     }
     else
     {
         Status.Text = Text;
     }
 }
Exemple #25
0
        /// <summary>
        /// settext an toàn - tránh hiện tượng cross-thread
        /// </summary>
        /// <param name="text"></param>
        /// <param name="lb"></param>
        public void SetStatusLabel(string text, ToolStripStatusLabel lb)
        {
            if (InvokeRequired)
            {
                SetStatusCallback d = new SetStatusCallback(SetStatusLabel);
                Invoke(d, new object[] { text, lb });

            }
            else
            {
                lb.Text = text;
            }
        }
 private void SetStatus(string text)
 {
     if (this.statusMsg.InvokeRequired)
     {
         SetStatusCallback callback = new SetStatusCallback(SetStatus);
         this.Invoke(callback, new object[] { text });
     }
     else
     {
         statusMsg.ForeColor = Color.Blue;
         statusMsg.Text = text;
         statusMsg.Update();
     }
 }
 /// <summary>
 /// Updates a user's Facebook status.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Users.SetStatusAsync("I'm an async code sample.", Constants.UserId, AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="status">The status message to set.  Note: The maximum message length is 255 characters; messages longer than that limit will be truncated and appended with '...'.</param>
 /// <param name="uid">The user ID of the user whose status you are setting. If this parameter is not specified, then it defaults to the session user.  Note: This parameter applies only to Web applications.  Facebook ignores this parameter if it is passed by a desktop application.</param>
 /// <param name="callback">The AsyncCallback delegate</param>
 /// <param name="state">An object containing state information for this asynchronous request</param>        
 /// <returns>This method returns true on success, false on failure, or an error code.</returns>
 public bool SetStatusAsync(string status, long uid, SetStatusCallback callback, Object state)
 {
     return SetStatusAsync(status, false, uid, callback, state);
 }
 /// <summary>
 /// Refreshes the view.
 /// </summary>
 /// <param name="status">The status.</param>
 /// <param name="url">The URL.</param>
 private void RefreshView(string status, string url)
 {
     if (txtStatus.InvokeRequired)
     {
         SetStatusCallback callback = new SetStatusCallback(RefreshView);
         this.Invoke(callback, status, url);
     }
     else
     {
         txtStatus.Text = status;
         lnkURL.Text = url;
     }            
 }
 private void SetStatus(String statusText)
 {
     if (this.InvokeRequired)
     {
         SetStatusCallback d = new SetStatusCallback(SetStatus);
         this.Invoke(d, new object[] { statusText });
     }
     else
     {
         this.mStatusStrip.Text = statusText;
     }
 }