Beispiel #1
0
        private int GetCurrentActivity()
        {
            _activityRows = adaScheduleDataSet1.Activity.Select("", "Sequence ASC");

            int currentActivity = -1;
            int count           = _activityRows.Length;

            for (int i = 0; i < count; i++)
            {
                AdaSchedulePpc.ADAMobileDataSet.ActivityRow row = _activityRows[i] as AdaSchedulePpc.ADAMobileDataSet.ActivityRow;

                bool isExecuted = (!row.IsExecutionStartNull() && !row.IsExecutionEndNull());

                if (currentActivity < 0)
                {
                    if (!isExecuted)
                    {
                        currentActivity = i;
                        break;
                    }
                }
            }

            return(currentActivity);
        }
Beispiel #2
0
        private void RefreshViews()
        {
            try
            {
                int currentActivity = -1;
                int count           = _activityRows.Length;

                symbolListView1.Items.Clear();
                listView1.Items.Clear();

                for (int i = 0; i < count; i++)
                {
                    AdaSchedulePpc.ADAMobileDataSet.ActivityRow row = _activityRows[i] as AdaSchedulePpc.ADAMobileDataSet.ActivityRow;
                    SymbolListView.SymbolListItem item = new SymbolListView.SymbolListItem();

                    bool isExecuted = (!row.IsExecutionStartNull() && !row.IsExecutionEndNull());

                    item.Checked = isExecuted;

                    if (currentActivity < 0)
                    {
                        if (!isExecuted)
                        {
                            currentActivity = i;
                        }
                    }

                    if (!row.IsSymbolIdNull())
                    {
                        if (!row.SymbolRow.IsImageNull())
                        {
                            item.Image = ImageEngine.FromArray(row.SymbolRow.Image);
                        }

                        if (!row.SymbolRow.IsSoundNull())
                        {
                            item.Sound = row.SymbolRow.Sound;
                        }
                    }

                    item.Text = string.Format("{0}:{1}", row.Sequence, row.Name);

                    symbolListView1.Items.Add(item);

                    ListViewItem lvItem = new ListViewItem();
                    lvItem.Text = row.Name;

                    if (!row.IsStartTimeNull())
                    {
                        lvItem.SubItems.Add(row.StartTime.ToString("hh:mm"));
                    }

                    if (!row.IsEndTimeNull())
                    {
                        lvItem.SubItems.Add(row.EndTime.ToString("hh:mm"));
                    }

                    lvItem.Tag     = isExecuted;
                    lvItem.Checked = isExecuted;
                    listView1.Items.Add(lvItem);
                }

                symbolListView1.SelectedIndex = currentActivity;
                menuItemCurrent.Enabled       = (currentActivity >= 0);
            }
            catch (Exception ex)
            {
                ReportError(ex);
            }
        }