コード例 #1
0
        private void Aircraft_OnUpdateAircraft(Aircraft sender, Aircraft.AircraftUpdateEventArgs e)
        {
            if (sender != DispAircraft)
            {
                return;
            }

            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker) delegate { Aircraft_OnUpdateAircraft(sender, e); });
            }
            else
            {
                //if we add a new case, repopulate the lists
                if (e.UpdateType == Aircraft.AircraftUpdateEventArgs.Update_Type.Added_Case)
                {
                    PopulateData();
                }
                //if a case has ended, find that listview item and change picture and status
                else if (e.UpdateType == Aircraft.AircraftUpdateEventArgs.Update_Type.Ended_Case)
                {
                    this.statusLabel.Text = "Executing Cases, Finished Case " + ((int)e.Message).ToString();

                    for (int i = 0; i < this.DispAircraft.Analyze_Cases.Count; i++)
                    {
                        if (this.DispAircraft.Analyze_Cases[i].Case_Index != (int)e.Message)
                        {
                            continue;
                        }
                        ListViewItem lvi = listView1.Groups[0].Items[i];
                        lvi.ImageIndex       = 1;
                        lvi.SubItems[2].Text = "Finished";
                        break;
                    }
                    if ((int)e.Message == listView1.Groups[0].Items.Count - 1)
                    {
                        this.statusLabel.Text = "Finished executing all cases";
                        runCaseButton.Enabled = true;
                    }
                }
                //if a case has just started, find that listview item and change picture and status
                else if (e.UpdateType == Aircraft.AircraftUpdateEventArgs.Update_Type.Started_Case)
                {
                    for (int i = 0; i < this.DispAircraft.Analyze_Cases.Count; i++)
                    {
                        if (this.DispAircraft.Analyze_Cases[i].Case_Index != (int)e.Message)
                        {
                            continue;
                        }
                        ListViewItem lvi = listView1.Groups[0].Items[i];
                        lvi.ImageIndex       = 4;//replace this with a 'pending' image
                        lvi.SubItems[2].Text = "Working";
                        break;
                    }
                }
            }
        }
コード例 #2
0
        private void Aircraft_OnUpdateAircraft(Aircraft sender, Aircraft.AircraftUpdateEventArgs e)
        {
            switch (e.UpdateType)
            {
            case Aircraft.AircraftUpdateEventArgs.Update_Type.Closed:
            {
                //remove the instance usercontrol
                InstanceUC iuc = null;
                foreach (Control c in flowLayoutPanel1.Controls)
                {
                    if (c.GetType() == typeof(InstanceUC))
                    {
                        if ((c as InstanceUC).aircraft == sender)
                        {
                            iuc = (c as InstanceUC);
                        }
                    }
                }

                if (iuc != null)
                {
                    flowLayoutPanel1.Controls.Remove(iuc);
                }

                //remove the constraint usercontrol
                ConstraintsUC cuc = null;
                foreach (Control c in flowLayoutPanel2.Controls)
                {
                    if (c.GetType() == typeof(ConstraintsUC))
                    {
                        if ((c as ConstraintsUC).DispAircraft == sender)
                        {
                            cuc = (c as ConstraintsUC);
                        }
                    }
                }

                if (cuc != null)
                {
                    flowLayoutPanel2.Controls.Remove(cuc);
                }

                //finally remove this aircraft from our list of designs
                designs.Remove(sender);
            }; break;
            }
        }
コード例 #3
0
ファイル: Aircraft_Info.cs プロジェクト: Bome1/AVLInterface
        private void Aircraft_OnUpdateAircraft(Aircraft sender, Aircraft.AircraftUpdateEventArgs e)
        {
            //if we are showing an aircraft and that aircraft raises a message, act
            if (m_ap != null && sender == m_ap)
            {
                switch (e.UpdateType)
                {
                case Aircraft.AircraftUpdateEventArgs.Update_Type.File_Load:
                {
                    m_ap = null;
                    SetAircraft(sender);
                }; break;

                case Aircraft.AircraftUpdateEventArgs.Update_Type.Closed: this.Clear(); break;
                }
            }
        }
コード例 #4
0
ファイル: ChartUC.cs プロジェクト: Bome1/AVLInterface
        private void Aircraft_OnUpdateAircraft(Aircraft sender, Aircraft.AircraftUpdateEventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker) delegate { Aircraft_OnUpdateAircraft(sender, e); });
            }
            else
            {
                switch (e.UpdateType)
                {
                case Aircraft.AircraftUpdateEventArgs.Update_Type.File_Load:
                case Aircraft.AircraftUpdateEventArgs.Update_Type.File_Save:
                {
                    foreach (ListViewGroup lvg in listView1.Groups)
                    {
                        if (lvg.Header == sender.Configuration_Name)
                        {
                            return;
                        }
                    }

                    this.listView1.Groups.Add(sender.Configuration_Name, sender.Configuration_Name);
                }; break;

                case Aircraft.AircraftUpdateEventArgs.Update_Type.Closed:
                {
                    if (listView1.Groups.Count > 0)
                    {
                        if (listView1.Groups[sender.Configuration_Name] != null)
                        {
                            for (int i = listView1.Groups[sender.Configuration_Name].Items.Count; i > 0; i--)
                            {
                                listView1.Items.Remove(listView1.Groups[sender.Configuration_Name].Items[i - 1]);
                            }

                            listView1.Groups[sender.Configuration_Name].Items.Clear();
                            listView1.Groups.Remove(listView1.Groups[sender.Configuration_Name]);
                            RefreshAllCharts();
                        }
                    }
                }; break;

                case Aircraft.AircraftUpdateEventArgs.Update_Type.Ended_Case:
                {
                    int    runIndex = (int)e.Message;
                    string key      = sender.Configuration_Name + "~~~" + runIndex.ToString();
                    if (!listView1.Items.ContainsKey(key))
                    {
                        ListViewItem lvi = listView1.Items.Add(key, sender.Analyze_Cases[runIndex].CaseNotes, 0);
                        lvi.Group = listView1.Groups[sender.Configuration_Name];
                    }
                    else
                    {
                        ListViewItem lvi = listView1.Items[key];
                        lvi.Text = sender.Analyze_Cases[runIndex].CaseNotes;
                    }
                    RefreshAllCharts();
                }; break;

                case Aircraft.AircraftUpdateEventArgs.Update_Type.Removed_Case:
                {
                    int    runIndex = (int)e.Message;
                    string key      = sender.Configuration_Name + "~~~" + runIndex.ToString();
                    listView1.Items.RemoveByKey(key);
                }; break;
                }
            }
        }