Exemple #1
0
        public void ProcessProgressionEvent(ProgressionEvent Event)
        {
            if (Event == null)
            {
                return;
            }

            // if we need to, invoke the delegate
            if (InvokeRequired)
            {
                Invoke(new DelegateProcessProgressionEvent(ProcessProgressionEvent), new object[] { Event });
                return;
            }

            if (Event.State == EProgressionState.InstigatorConnected)
            {
                ProgressionData = new Progressions();
                OverallProgressBar.Invalidate();
            }

            if (ProgressionData != null)
            {
                if (ProgressionData.ProcessEvent(Event))
                {
                    VisualiserGridViewResized = true;
                    VisualiserGridView.Invalidate();
                    OverallProgressBar.Invalidate();
                }
            }
        }
Exemple #2
0
        public void Tick()
        {
            if (ProgressionData != null)
            {
                PopulateGridView();

                if (ProgressionData.Tick())
                {
                    VisualiserGridView.Invalidate();
                }
            }
        }
Exemple #3
0
        private void MouseWheelHandler(object sender, MouseEventArgs e)
        {
            float ZoomLevel = AgentApplication.Options.VisualiserZoomLevel + (e.Delta / 120.0f);

            if (ZoomLevel < 1.0f)
            {
                ZoomLevel = 1.0f;
            }
            else if (ZoomLevel > 100.0f)
            {
                ZoomLevel = 100.0f;
            }

            AgentApplication.Options.VisualiserZoomLevel = ZoomLevel;
            VisualiserGridView.Invalidate();
        }
Exemple #4
0
 private void GridViewSelectionChanged(object sender, EventArgs e)
 {
     VisualiserGridView.ClearSelection();
 }
Exemple #5
0
        /*
         * Populate the gridview if the number of connected machines has changed
         */
        public void PopulateGridView()
        {
            if (VisualiserGridViewResized || ProgressionData.MachineProgressions.Count != VisualiserGridView.Rows.Count)
            {
                VisualiserGridView.Rows.Clear();

                // Sort the machines by state and then by time
                List <KeyValuePair <string, Progression> > CopyOfProgressionData =
                    new List <KeyValuePair <string, Progression> >(ProgressionData.MachineProgressions.Copy());

                // Disable the sort for now, because lots of movement is distracting
                //CopyOfProgressionData.Sort( CompareByStateAndTime );

                List <string> MachineNames = new List <string>();
                foreach (KeyValuePair <string, Progression> NextPair in CopyOfProgressionData)
                {
                    MachineNames.Add(NextPair.Key);
                }

                // Always move the local machine name to the top of the list
                if (MachineNames.Remove(Environment.MachineName))
                {
                    MachineNames.Insert(0, Environment.MachineName);
                }

                // Find ideal row height dependent on number of agents
                int RowHeight = CalculateIdealBarHeight(MachineNames.Count);

                foreach (string Machine in MachineNames)
                {
                    DataGridViewRow Row = new DataGridViewRow();
                    Row.Height = RowHeight;

                    DataGridViewTextBoxCell NameCell = new DataGridViewTextBoxCell();
                    NameCell.Value = Machine;
                    Row.Cells.Add(NameCell);

                    DataGridViewTextBoxCell ProgressCell = new DataGridViewTextBoxCell();
                    Row.Cells.Add(ProgressCell);

                    VisualiserGridView.Rows.Add(Row);
                }

                VisualiserGridViewResized = false;
                VisualiserGridView.Invalidate();
            }

            // Handle the horizontal scroll bar
            VisualiserGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;

            // Get the largest width of each row
            int ProgressionWidth = 0;

            foreach (Progression ProgressionMachine in ProgressionData.MachineProgressions.Values)
            {
                if (ProgressionMachine.ProgressTotalWidth > ProgressionWidth)
                {
                    ProgressionWidth = ProgressionMachine.ProgressTotalWidth;
                }
            }
            ProgressionWidth += 10;             // Add a small margin.

            // Figure out the desired width of the 2nd column.
            int ColumnWidth = VisualiserGridView.Columns[1].Width;

            if (ColumnWidth <= ProgressionWidth || ColumnWidth > (ProgressionWidth + 200))
            {
                ColumnWidth = ProgressionWidth + 200;
            }

            // Make sure it never goes smaller than the container
            int ContainerWidth = VisualiserGridView.Width - VisualiserGridView.Columns[0].Width - 3;

            if (ColumnWidth < ContainerWidth)
            {
                ColumnWidth = ContainerWidth;
            }

            // WINDOWS BUG: no width larger than 64k
            if (ColumnWidth > 65536)
            {
                ColumnWidth = 65536;
            }

            if (VisualiserGridView.Columns[1].Width != ColumnWidth)
            {
                VisualiserGridView.Columns[1].Width = ColumnWidth;
                VisualiserGridView.Invalidate();
            }
        }