Ejemplo n.º 1
0
 void OnTransactionProgress(object sender, GXTransactionProgressEventArgs e)
 {
     if (e.Current > e.Maximum)
     {
         System.Diagnostics.Debug.WriteLine("OnTransactionProgress failed. Current value is higger than maximum.");
     }
     else if (this.InvokeRequired)
     {
         this.BeginInvoke(new Gurux.Device.TransactionProgressEventHandler(TransactionProgress), new object[] { sender, e });
     }            
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Show active item transaction progress in status bar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TransactionProgress(object sender, GXTransactionProgressEventArgs e)
        {
            try
            {
                DeviceStates status = e.Status;
                //If user has change item OnSelectedObjectChanged will call this.
                GXDevice device = GXTransactionManager.GetDevice(e.Item);
                GXDevice activeDevice = GXTransactionManager.GetDevice(Director.m_DeviceList.SelectedItem);
                if (device == activeDevice)
                {
                    /* TODO:
                    if ((status & DeviceStates.ReadStart) != 0)
                    {
                        TransactionObject = e.Item;
                        StatusLbl.Text = Gurux.DeviceSuite.Properties.Resources.ReadingTxt;
                    }
                    else if ((status & DeviceStates.WriteStart) != 0)
                    {
                        TransactionObject = e.Item;
                        StatusLbl.Text = Gurux.DeviceSuite.Properties.Resources.WritingTxt;
                    }
                    else if ((status & (DeviceStates.WriteEnd | DeviceStates.ReadEnd)) != 0)
                    {
                        StatusLbl.Text = Gurux.DeviceSuite.Properties.Resources.ReadyTxt;
                    }
                     * */

                    if (status == DeviceStates.None)
                    {
                        Progress.Value = 0;
                        if (device == null)
                        {                            
                            return;
                        }
                        e = device.GetTransactionProgress();
                    }
                    if ((status & (DeviceStates.ReadStart | DeviceStates.WriteStart)) != 0)
                    {                        
                        try
                        {
                            Progress.Maximum = e.Maximum;
                            Progress.Value = e.Current;
                        }
                        catch(Exception ex)
                        {
                            System.Diagnostics.Debug.WriteLine(ex.Message);
                        }
                        if (TransactionObject == null || TransactionObject == e.Item)
                        {
                            TransactionObject = e.Item;
                            Progress.Visible = true;
                            if ((status & DeviceStates.ReadStart) != 0)
                            {
                                StatusLbl.Text = Gurux.DeviceSuite.Properties.Resources.ReadingTxt;
                            }
                            else if ((status & DeviceStates.WriteStart) != 0)
                            {
                                StatusLbl.Text = Gurux.DeviceSuite.Properties.Resources.WritingTxt;
                            }
                        }
                    }
                    else if ((status & (DeviceStates.ReadEnd | DeviceStates.WriteEnd)) != 0)
                    {                        
                        if (TransactionObject == e.Item && e.Current == e.Maximum)
                        {
                            TransactionObject = null;
                            Progress.Value = 0;
                            Progress.Visible = false;
                            StatusLbl.Text = Gurux.DeviceSuite.Properties.Resources.ReadyTxt;
                        }
                    }                    
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 3
0
		/// <summary>
		/// Notifies the current transaction.
		/// </summary>
		public void NotifyTransactionProgress(object sender, GXTransactionProgressEventArgs e)
		{
			if (FreezeEvents == 0 && OnTransactionProgress != null)
			{
				OnTransactionProgress(sender, e);
			}
			if (this.DeviceList != null)
			{
				DeviceList.NotifyTransactionProgress(sender, e);
			}
		}
Ejemplo n.º 4
0
 internal void NotifyTransactionProgress(object sender, GXTransactionProgressEventArgs e)
 {
     if (this.FreezeEvents == 0 && OnTransactionProgress != null)
     {
         OnTransactionProgress(sender, e);
     }
 }
Ejemplo n.º 5
0
		/// <summary>
		/// Gets progress of the current transaction.
		/// </summary>
		public GXTransactionProgressEventArgs GetTransactionProgress()
		{
			GXTransactionProgressEventArgs status = new GXTransactionProgressEventArgs(TransactionObject, TransactionPos, TransactionCount, this.Status);
			return status;
		}