private int GetCurrentActivity() { DataRow[] dataRows = adaScheduleDataSet1.Activity.Select("ScheduleId=" + _scheduleRow.ScheduleId, "Sequence ASC"); int currentActivity = -1; int count = dataRows.Length; for (int i = 0; i < count; i++) { ADAMobileDataSet.ActivityRow row = dataRows[i] as ADAMobileDataSet.ActivityRow; bool isExecuted = (!row.IsExecutionStartNull() && !row.IsExecutionEndNull()); if (currentActivity < 0) { if (!isExecuted) { currentActivity = i; break; } } } return(currentActivity); }
private void ShowWorkSystem(ADAMobileDataSet.ScheduleRow scheduleRow) { int scheduleId = scheduleRow.ScheduleId; _scheduleRow = scheduleRow; symbolListView1.Items.Clear(); DataRow[] dataRows = adaScheduleDataSet1.Activity.Select("ScheduleId=" + scheduleId, "Sequence ASC"); int count = dataRows.Length; int currentActivity = -1; for (int i = 0; i < count; i++) { ADAMobileDataSet.ActivityRow activityRow = dataRows[i] as ADAMobileDataSet.ActivityRow; SymbolListView.SymbolListItem item = new SymbolListView.SymbolListItem(); bool isExecuted = (!activityRow.IsExecutionStartNull() && !activityRow.IsExecutionEndNull()); item.Checked = isExecuted; if (currentActivity < 0) { if (!isExecuted) { currentActivity = i; } } if (!activityRow.IsSymbolIdNull()) { if (activityRow.SymbolRow != null && !activityRow.SymbolRow.IsImageNull()) { item.Image = ImageEngine.FromArray(activityRow.SymbolRow.Image); } if (activityRow.SymbolRow != null && !activityRow.SymbolRow.IsSoundNull()) { item.Sound = activityRow.SymbolRow.Sound; } } item.Text = string.Format("{0}:{1}", activityRow.Sequence, activityRow.Name); symbolListView1.Items.Add(item); } symbolListView1.SelectedIndex = currentActivity; symbolListView1.Invalidate(); menuItemCurrent.Enabled = (currentActivity >= 0); menuItemCurrent.Text = "Current"; this.Text = scheduleRow.Name; EnablePrevNextPageMenuItems(); }
private void ActivityDetailForm_Load(object sender, EventArgs e) { if (_activityRow != null) { if (!_activityRow.IsSymbolIdNull()) { if (!_activityRow.SymbolRow.IsImageNull()) { Image image = ImageEngine.FromArray(_activityRow.SymbolRow.Image); if (image.Width <= pictureBox1.Width && image.Height <= pictureBox1.Height) { pictureBox1.Image = image; } else { ResizeImage(image); } } if (!_activityRow.SymbolRow.IsSoundNull()) { menuItemPlaySound.Enabled = true; } } this.Text = _activityRow.Name; StringBuilder sb = new StringBuilder(); if (_activityRow.IsExecutionStartNull()) { sb.Append("Not Started"); } else if (_activityRow.IsExecutionEndNull()) { sb.Append("Started"); } else { sb.Append("Finished"); } labelDescription.Text = sb.ToString(); if (_isCurrentActivity) { menuItemStart.Enabled = true; if (!_activityRow.IsExecutionStartNull()) { menuItemStart.Text = AdaWorkSystemPpc.Properties.Resources.MenuStop; } } } }