コード例 #1
0
        private void CategoryDetailForm_Load(object sender, EventArgs e)
        {
            try
            {
                LocalizedCategoryNameTableAdapter localizedCategoryNameAdapter = new LocalizedCategoryNameTableAdapter();
                localizedCategoryNameAdapter.Fill(this.categoryDetailDataSet.LocalizedCategoryName, categoryId, cultureName);

                if (categoryId > 0)
                {
                    CategoryTableAdapter categoryAdapter = new CategoryTableAdapter();
                    categoryAdapter.Fill(this.categoryDetailDataSet.Category, categoryId);
                }

                byte[] image = this.categoryDetailDataSet.Category.Rows[0]["Image"] as byte[];
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                EnableButtons();
            }
            catch (Exception ex)
            {
                ReportError(ex.Message.ToString());
                this.DialogResult = DialogResult.Abort;
                this.Close();
            }
        }
コード例 #2
0
ファイル: ActivityDetailForm.cs プロジェクト: nakijun/adasg
        private void ActivityDetailForm_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow;

            if (!activityRow.IsSymbolIdNull())
            {
                if (!activityRow.SymbolRow.IsImageNull())
                {
                    byte[] image = activityRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            ADAScheduleDataSet.Activity_ReminderRow[] activityReminderRows = activityRow.GetActivity_ReminderRows();

            foreach (ADAScheduleDataSet.Activity_ReminderRow activityReminderRow in activityReminderRows)
            {
                if (!activityReminderRow.IsTimeNull() &&
                    activityReminderRow.ReminderId == ADADataAccess.Constants.ALARM_REMINDER_ID)
                {
                    this.dateTimePickerAlarm.Value = activityReminderRow.Time;
                    _alarmTimeSpan = activityReminderRow.Time - activityRow.EndTime;
                }
            }

            buttonPlaySound.Enabled = (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsSoundNull());
        }
コード例 #3
0
ファイル: TextDetailForm.cs プロジェクト: nakijun/adasg
        private void TextDetailForm_Load(object sender, EventArgs e)
        {
            if (_textRow != null)
            {
                if (!_textRow.IsSymbolIdNull())
                {
                    if (!_textRow.SymbolRow.IsImageNull())
                    {
                        Image image = ImageEngine.FromArray(_textRow.SymbolRow.Image);

                        if (image.Width <= pictureBox1.Width && image.Height <= pictureBox1.Height)
                        {
                            pictureBox1.Image = image;
                        }
                        else
                        {
                            ResizeImage(image);
                        }
                    }

                    if (!_textRow.SymbolRow.IsSoundNull())
                    {
                        menuItemPlaySound.Enabled = true;
                    }
                }

                this.Text = _textRow.Name;

                labelDescription.Text = _textRow.Descripton;

                menuItemSpeak.Enabled = (_textRow.Descripton.Length > 0);
            }
        }
コード例 #4
0
        private void ShowScenarios()
        {
            ADAMobileDataSet.ScenarioRow lastScenarioRow = null;

            if (_scenarioRow != null)
            {
                lastScenarioRow = _scenarioRow;
                _scenarioRow    = null;
            }

            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScenarioDataSet1.Scenario.Select("", "Name ASC");
            int       count    = dataRows.Length;

            int selectedScenario = (count > 0 ? 0 : -1);

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

                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 = row.Name;

                symbolListView1.Items.Add(item);

                if (lastScenarioRow == row)
                {
                    selectedScenario = i;
                }
            }

            if (selectedScenario >= 0)
            {
                symbolListView1.SelectedIndex = selectedScenario;
            }

            menuItemSelect.Text = "Select";

            this.Text = "Select Scenario";
            symbolListView1.Invalidate();
            symbolListView1.Focus();

            EnablePrevNextPageMenuItems();
        }
コード例 #5
0
 private void buttonCopyImage_Click(object sender, EventArgs e)
 {
     if (this.pictureBoxImage.Image != null)
     {
         DataRowView view  = this.BindingContext[categoryDetailDataSet, CATEGORY].Current as DataRowView;
         byte[]      image = view.Row["Image"] as byte[];
         Clipboard.SetImage(ImageEngine.FromArray(image));
     }
 }
コード例 #6
0
        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();
        }
コード例 #7
0
        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;
                    }
                }
            }
        }
コード例 #8
0
ファイル: TextDetailForm.cs プロジェクト: nakijun/adasg
        private void buttonChangeSymbol_Click(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaCommunicatorDataSet1, TEXT_TABLE].Current as DataRowView;

            ADACommunicatorDataSet.TextRow textRow = view.Row as ADACommunicatorDataSet.TextRow;

            SymbolPicker picker = new SymbolPicker();

            SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this,
                                                                           textRow.IsSymbolIdNull() ? -1 : textRow.SymbolId);

            if (symbolRow != null)
            {
                if (adaCommunicatorDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null)
                {
                    ADACommunicatorDataSet.SymbolRow newRow = adaCommunicatorDataSet1.Symbol.NewSymbolRow();
                    newRow.SymbolId = symbolRow.SymbolId;

                    if (!symbolRow.IsSoundNull())
                    {
                        newRow.Sound = symbolRow.Sound;
                    }

                    if (!symbolRow.IsImageNull())
                    {
                        newRow.Image = symbolRow.Image;
                    }

                    adaCommunicatorDataSet1.Symbol.AddSymbolRow(newRow);
                    adaCommunicatorDataSet1.Symbol.AcceptChanges();
                }

                byte[] image = symbolRow.Image;
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                buttonPlaySound.Enabled = !symbolRow.IsSoundNull();

                this.BindingContext[adaCommunicatorDataSet1, TEXT_TABLE].EndCurrentEdit();

                view.BeginEdit();
                if (textRow.IsNameNull() || textRow.Name.Length == 0)
                {
                    textRow.Name = symbolRow.Name;
                }
                if (textRow.IsDescriptonNull() || textRow.Descripton.Length == 0)
                {
                    textRow.Descripton = textRow.Name;
                }
                textRow.SymbolId = symbolRow.SymbolId;
                view.EndEdit();
            }
        }
コード例 #9
0
ファイル: ActivityDetailForm.cs プロジェクト: nakijun/adasg
        private void buttonChangeSymbol_Click(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow;

            SymbolPicker picker = new SymbolPicker();

            SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this,
                                                                           activityRow.IsSymbolIdNull() ? -1 : activityRow.SymbolId);

            if (symbolRow != null)
            {
                if (adaScheduleDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null)
                {
                    ADAScheduleDataSet.SymbolRow newRow = adaScheduleDataSet1.Symbol.NewSymbolRow();
                    newRow.SymbolId = symbolRow.SymbolId;

                    if (!symbolRow.IsSoundNull())
                    {
                        newRow.Sound = symbolRow.Sound;
                    }

                    if (!symbolRow.IsImageNull())
                    {
                        newRow.Image = symbolRow.Image;
                    }

                    adaScheduleDataSet1.Symbol.AddSymbolRow(newRow);
                }

                byte[] image = symbolRow.Image;
                if (image != null)
                {
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }

                buttonPlaySound.Enabled = !symbolRow.IsSoundNull();

                this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].EndCurrentEdit();

                view.BeginEdit();
                activityRow.Name     = symbolRow.Name;
                activityRow.SymbolId = symbolRow.SymbolId;
                activityRow.Image    = image;
                view.EndEdit();
            }
        }
コード例 #10
0
        private void ShowTextButtons(ADAMobileDataSet.ScenarioRow scenarioRow)
        {
            int scenarioId = scenarioRow.ScenarioId;

            _scenarioRow = scenarioRow;

            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScenarioDataSet1.Text.Select("ScenarioId=" + scenarioId, "Name ASC");
            int       count    = dataRows.Length;

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.TextRow      textRow = dataRows[i] as ADAMobileDataSet.TextRow;
                SymbolListView.SymbolListItem item    = new SymbolListView.SymbolListItem();

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

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

                item.Text = textRow.Name;

                symbolListView1.Items.Add(item);
            }

            if (count > 0)
            {
                symbolListView1.SelectedIndex = 0;
            }

            symbolListView1.Invalidate();
            symbolListView1.Focus();

            menuItemSelect.Text = "Detail";

            this.Text = scenarioRow.Name;

            EnablePrevNextPageMenuItems();
        }
コード例 #11
0
        private void WorkSystemDetail_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaWorkSystemDataSet1, SCHEDULE_TABLE].Current as DataRowView;

            ADAWorkSystemDataSet.ScheduleRow scheduleRow = view.Row as ADAWorkSystemDataSet.ScheduleRow;

            if (!scheduleRow.IsSymbolIdNull())
            {
                if (!scheduleRow.SymbolRow.IsImageNull())
                {
                    byte[] image = scheduleRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            buttonPlaySound.Enabled = (!scheduleRow.IsSymbolIdNull() && !scheduleRow.SymbolRow.IsSoundNull());
        }
コード例 #12
0
ファイル: ActivityDetailForm.cs プロジェクト: nakijun/adasg
        private void ActivityDetailForm_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaWorkSystemDataSet1, ACTIVITY_TABLE].Current as DataRowView;

            ADAWorkSystemDataSet.ActivityRow activityRow = view.Row as ADAWorkSystemDataSet.ActivityRow;

            if (!activityRow.IsSymbolIdNull())
            {
                if (!activityRow.SymbolRow.IsImageNull())
                {
                    byte[] image = activityRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            buttonPlaySound.Enabled = (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsSoundNull());
        }
コード例 #13
0
        private void ScenarioDetailForm_Load(object sender, EventArgs e)
        {
            DataRowView view = this.BindingContext[adaCommunicatorDataSet1, SCENARIO_TABLE].Current as DataRowView;

            ADACommunicatorDataSet.ScenarioRow scenarioRow = view.Row as ADACommunicatorDataSet.ScenarioRow;

            if (!scenarioRow.IsSymbolIdNull())
            {
                if (!scenarioRow.SymbolRow.IsImageNull())
                {
                    byte[] image = scenarioRow.SymbolRow.Image;
                    this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size);
                }
            }

            buttonPlaySound.Enabled = (!scenarioRow.IsSymbolIdNull() && !scenarioRow.SymbolRow.IsSoundNull());
        }
コード例 #14
0
        private void ShowModels()
        {
            _scheduleRow = null;
            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScheduleDataSet1.Schedule.Select("Type = " + (int)ScheduleType.WorkSystemModel, "Name ASC");
            int       count    = dataRows.Length;

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

                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 = row.Name;

                symbolListView1.Items.Add(item);
            }

            if (count > 0)
            {
                symbolListView1.SelectedIndex = 0;
            }

            menuItemCurrent.Enabled = (count > 0);
            menuItemCurrent.Text    = "View";

            this.Text = "Select Work System";
            symbolListView1.Invalidate();

            EnablePrevNextPageMenuItems();
        }
コード例 #15
0
ファイル: MainForm.cs プロジェクト: nakijun/adasg
        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);
            }
        }