void UpdateStatus() { try { //check running before read status if (!IsRunnig && Status != BarbaStatus.Stopped) { Status = BarbaStatus.Stopped; if (StatusChanged != null) { StatusChanged(this, new EventArgs()); } } //read status StringBuilder st = new StringBuilder(100); GetPrivateProfileString("General", "Status", "", st, 100, CommFilePath); if (String.IsNullOrEmpty(st.ToString())) { return; } BarbaStatus status = IsRunnig ? (BarbaStatus)Enum.Parse(typeof(BarbaStatus), st.ToString(), false) : BarbaStatus.Stopped; //check idle state if (status == BarbaStatus.Started && IsIdle) { status = BarbaStatus.Idle; } //update status if it change if (Status != status) { Status = status; if (StatusChanged != null) { StatusChanged(this, new EventArgs()); } } } catch { } }
public BarbaComm() { Status = BarbaStatus.Stopped; Directory.CreateDirectory(WorkinFolderPath); }