コード例 #1
0
ファイル: GcInfoView.cs プロジェクト: lelonek1/perfview-1
        /// <summary>
        /// Create GCInfo panel
        /// </summary>
        internal Panel CreateGCInfoPanel(TextBox helpBox)
        {
            m_helpBox = helpBox;

            StackPanel reason = new StackPanel();
            {
                reason.AddTextBlock("GC Reason ", "GCReason", OnHelp, 3, 2);
                reason.AddButton("Select All", 60, ReasonSelectAll, 3, 2);

                m_inducedBlocking    = reason.AddCheckBox(true, "Induced Blocking", 3, 2, UpdateEvents);
                m_inducedNonblocking = reason.AddCheckBox(true, "Induced Nonblocking", 3, 0, UpdateEvents);
                m_lowMemory          = reason.AddCheckBox(true, "Low Memory", 3, 0, UpdateEvents);
                m_allocSOH           = reason.AddCheckBox(true, "Alloc SOH", 3, 0, UpdateEvents);
                m_AllocLOH           = reason.AddCheckBox(true, "Alloc LOH", 3, 0, UpdateEvents);
            }

            StackPanel gen = new StackPanel();
            {
                gen.AddTextBlock("Generation ", "Generation", OnHelp, 3, 2);
                gen.AddButton("Select All", 60, GenerationSelectAll, 3, 2);

                m_g0           = gen.AddCheckBox(true, "0", 3, 0, UpdateEvents);
                m_g1           = gen.AddCheckBox(true, "1", 3, 0, UpdateEvents);
                m_g2Blocking   = gen.AddCheckBox(true, "2(Blocking)", 3, 0, UpdateEvents);
                m_g2Background = gen.AddCheckBox(true, "2(Background)", 3, 0, UpdateEvents);
            }

            StackPanel controls = new StackPanel();

            controls.Background = Brushes.LightGray;
            controls.Width      = 240;
            controls.Children.Add(Toolbox.Stack(Orientation.Horizontal, reason, gen));

            m_grid                     = new DataGrid();
            m_grid.Background          = Brushes.LightGray;
            m_grid.MouseRightButtonUp += MouseRightButtonUp;
            m_grid.AutoGenerateColumns = false;
            m_grid.IsReadOnly          = true;

            // Columns
            m_grid.AddColumn(Toolbox.CreateTextBlock("GCIndex ", "GCIndex", OnHelp), "Number", true, Toolbox.CountFormatN0);
            m_grid.AddColumn(Toolbox.CreateTextBlock("Gen ", "GenNumberWithSuffix", OnHelp), "GenerationName");
            m_grid.AddColumn(Toolbox.CreateTextBlock("Reason ", "GCReason", OnHelp), "Reason");
            m_grid.AddColumn("PauseStart", "PauseStart", true, Toolbox.TimeFormat);
            m_grid.AddColumn("Pause", "PauseDuration", true, Toolbox.TimeFormat);

            m_grid.AddColumn("SizeBefore", "SizeBefore", true, Toolbox.MemoryFormatN0);
            m_grid.AddColumn("SizeAfter", "SizeAfter", true, Toolbox.MemoryFormatN0);

            m_grid.AddColumn("GCHandle", "GcHandleCount", true, Toolbox.CountFormatN0);
            m_grid.AddColumn("SyncBlock", "SyncBlockCount", true, Toolbox.CountFormatN0);
            m_grid.AddColumn("PinnedObj", "PinObjectCount", true, Toolbox.CountFormatN0);

            InitHelpText();

            return(Toolbox.DockTopLeft(null, controls, m_grid));
        }
コード例 #2
0
        /// <summary>
        /// Synchronizes the columns of a datagrid and a datatable
        /// Needs to be done, because later created columns in a datatbale do not
        /// get visible in the datagrid (no Rebind, Items.Refresh(),... helps),
        /// so they have to be created manually and bound to the datatable
        /// </summary>
        /// <param name="grid">the datagrid</param>
        /// <param name="table">the datatable</param>
        public static void SynchronizeColumns(this DataGrid grid, DataTable table)
        {
            if (grid == null)
            {
                throw new System.ArgumentNullException("grid");
            }

            // add new columns
            foreach (DataColumn column in table.Columns)
            {
                // DataTable-> DataGrid: add columns to the datagrid, which not exist
                if (!grid.Columns.Any(x => x.Header.ToString() == column.Caption))
                {
                    grid.AddColumn(column.ColumnName, column.Caption, column.DataType);
                }
            }

            // remove not existing columns
            foreach (DataGridColumn column in grid.Columns.ToList())
            {
                // DataGrid -> DataTable: remove columns in the datagrid, which not exist
                if (!table.Columns.Cast <DataColumn>().Any(x => x.Caption == column.Header.ToString()))
                {
                    grid.Columns.Remove(column);
                }
            }
        }
コード例 #3
0
 public static void AddColumns(this DataGrid self, string[] columnsNames)
 {
     foreach (var name in columnsNames)
     {
         self.AddColumn(name);
     }
 }
コード例 #4
0
        /// <summary>
        /// Create HeapAllocView panel
        /// </summary>
        internal Panel CreateHeapAllocPanel(TraceLog traceLog)
        {
            StackPanel controls = new StackPanel();

            controls.Background = Brushes.LightGray;
            controls.Width      = 240;

            m_grid            = new DataGrid();
            m_grid.Background = Brushes.LightGray;

            m_grid.AutoGenerateColumns = false;
            m_grid.IsReadOnly          = true;

            AllocTickConverter converter = new AllocTickConverter(traceLog);

            // Columns
            m_grid.AddColumn("Type", "Type");

            m_grid.AddColumn("CountL", "CountLarge", true);
            m_grid.AddColumn("AllocL", "AllocLarge", converter, null, true);
            m_grid.AddColumn("CountS", "CountSmall", true);
            m_grid.AddColumn("AllocS", "AllocSmall", converter, null, true);
            m_grid.AddColumn("Caller1", "Caller1", converter);
            m_grid.AddColumn("Caller2", "Caller2", converter);

            return(Toolbox.DockTopLeft(null, controls, m_grid));
        }
コード例 #5
0
        /// <summary>
        /// Creates an email setup window.
        /// </summary>
        /// <param name="_emailDevice">A device with email capabiilities.</param>
        public EmailWindow(ConnectOneDevice _emailDevice)
        {
            Glide.FitToScreen = true;
            // Tell Glide to use our custom keyboard.
            Glide.Keyboard = InitKeyboard();

            //load the window graphics
            this.emailWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.wndEmail));

            TextBox txtBoxEmailSetup = (TextBox)emailWindow.GetChildByName("txtBoxEmailSetup");

            txtBoxEmailSetup.TapEvent += new OnTap(Glide.OpenKeyboard);

            Button btnEnter = (Button)emailWindow.GetChildByName("btnEnter");

            btnEnter.TapEvent += new OnTap(btnEnter_TapEvent);

            Button btnExit = (Button)emailWindow.GetChildByName("btnExit");

            btnExit.TapEvent += new OnTap(btnExit_TapEvent);

            emailDevice = _emailDevice;

            #region Mailbox Datagrid Initialize

            // Setup the dataGrid reference.
            dGridMailbox = (DataGrid)emailWindow.GetChildByName("dGridMailbox");

            // Listen for tap cell events.
            dGridMailbox.TapCellEvent += new OnTapCell(dGridMailbox_TapCellEvent);

            // Create columns in data grid.
            dGridMailbox.AddColumn(new DataGridColumn("        MAILBOX", 125));
            dGridMailbox.AddColumn(new DataGridColumn("SETUP", 185));

            // Populate the data grid with data.
            PopulateMailbox(false);

            // Add the data grid to the window before rendering it.
            emailWindow.AddChild(dGridMailbox);
            dGridMailbox.Render();

            #endregion
        }
コード例 #6
0
 public static void GenerateColumnsFromList <T>(this DataGrid grid, IEnumerable <T> objectList)
 {
     if (objectList.Any())
     {
         objectList.First().GetType().GetProperties().ForEach(a =>
         {
             grid.AddColumn(a.Name, a.Name, a.PropertyType);
         });
     }
 }
コード例 #7
0
 public FindResultsGrid(List<FindResultLine> list)
 {
     var dg = new DataGrid() 
     { 
         AutoGenerateColumns = false, 
         Height = 450, // starting size, will be dynamic based on window...
         Width = 900,
         SelectionMode= DataGridSelectionMode.Single 
     };
     this.Width = dg.Width + 25;
     this.Height = dg.Height + 42;
     dg.AddColumn("Item", "ItemName", width: 151);
     dg.AddColumn("Line #", "lineNbr", width: 51);
     dg.AddColumn("Text", "lineText");
     dg.SetBinding(DataGrid.WidthProperty, new Binding("ActualWidth") { Source = this, Converter=new WidthConversion() });
     dg.SetBinding(DataGrid.HeightProperty, new Binding("ActualHeight") { Source = this, Converter=new HeightConversion() });
 
     this.Content = dg;
     dg.ItemsSource = list;
 }
コード例 #8
0
        internal Panel CreateIssuePanel(TextBox help)
        {
            m_help = help;

            m_grid = new DataGrid();
            m_grid.AutoGenerateColumns = false;
            m_grid.IsReadOnly          = true;

            // Columns
            m_grid.AddColumn("Id", "Id");
            m_grid.AddColumn("Type", "Type");
            m_grid.AddColumn("Description", "Description");
            m_grid.AddColumn("Suggestion", "Suggestion");
            m_grid.AddButtonColumn(typeof(Issue), "Action", "Action", OnClick);

            m_leftPanel            = new StackPanel();
            m_leftPanel.Width      = LeftPanelWidth;
            m_leftPanel.Background = Brushes.LightGray;

            DockPanel issuePanel = Toolbox.DockTopLeft(null, m_leftPanel, m_grid);

            return(issuePanel);
        }
コード例 #9
0
        protected override void OnInitialized()
        {
            if (!Hideable.HasValue)
            {
                Hideable = DataGrid?.Hideable;
            }

            groupBy = GroupBy;
            CompileGroupBy();

            if (groupable && Grouping)
            {
                grouping = Grouping;
            }

            DataGrid?.AddColumn(this);

            // Add the HeaderContext
            headerContext = new HeaderContext <T>
            {
                dataGrid = DataGrid,
                Actions  = new HeaderContext <T> .HeaderActions
                {
                    SetSelectAll = async(x) => await DataGrid.SetSelectAllAsync(x),
                }
            };
            // Add the FooterContext
            footerContext = new FooterContext <T>
            {
                dataGrid = DataGrid,
                Actions  = new FooterContext <T> .FooterActions
                {
                    SetSelectAll = async(x) => await DataGrid.SetSelectAllAsync(x),
                }
            };
        }
コード例 #10
0
        internal Panel CreateThreadViewPanel()
        {
            m_grid = new DataGrid();
            m_grid.AutoGenerateColumns = false;
            m_grid.IsReadOnly          = true;

            // Columns
            m_grid.AddColumn("Thread", "ThreadID");
            m_grid.AddColumn("Name", "Name");
            m_grid.AddColumn("CPU", "CpuSample", true, Toolbox.TimeFormatN0);
            m_grid.AddColumn("CPU %", "CpuSamplePercent", true, Toolbox.PercentageFormat);
            m_grid.AddColumn("FirstEvent", "FirstEvent", true, Toolbox.TimeFormat);
            m_grid.AddColumn("LastEvent", "LastEvent", true, Toolbox.TimeFormat);
            m_grid.AddColumn("CLRContention", "CLRContentionCount", true, Toolbox.CountFormatN0);

            m_leftPanel            = new StackPanel();
            m_leftPanel.Width      = LeftPanelWidth;
            m_leftPanel.Background = Brushes.LightGray;

            DockPanel threadPanel = Toolbox.DockTopLeft(null, m_leftPanel, m_grid);

            return(threadPanel);
        }
コード例 #11
0
ファイル: HeapDiagram.cs プロジェクト: raffaeler/perfview-1
        internal Panel CreateHeapDiagramPanel(TextBox helpBox)
        {
            // Top: controls
            m_topPanel = new DockPanel();
            {
                m_topPanel.Height     = TopPanelHeight;
                m_topPanel.Background = Brushes.LightGray;

                m_topPanel.DockLeft(m_timeline = Toolbox.CreateCheckBox(false, "Timeline", 10, 5, ToggleTimeline));
                m_timeline.ToolTip             = "Overlay thread time line.";

                m_topPanel.DockLeft(m_drawMarker = Toolbox.CreateCheckBox(false, "Marker", 10, 5, ToggleDrawMarker));
                m_drawMarker.ToolTip             = "Overlay GC marking events on thread time line.";
                m_drawMarker.IsEnabled           = false;

                m_zoomSlider               = new Slider();
                m_zoomSlider.Margin        = new Thickness(10, 2, 10, 2);
                m_zoomSlider.Minimum       = 1;
                m_zoomSlider.Maximum       = MaxZoom;
                m_zoomSlider.Value         = 1;
                m_zoomSlider.Width         = 200;
                m_zoomSlider.Ticks         = new DoubleCollection(new double[] { 1, 2, 4, 8, 10, 16, 32, 50, 64, MaxZoom });
                m_zoomSlider.TickPlacement = TickPlacement.BottomRight;
                m_zoomSlider.ValueChanged += ZoomValueChanged;
                m_zoomSlider.ToolTip       = "Change time axis zoom ratio.";
                m_topPanel.DockLeft(m_zoomSlider);

                m_zoomLabel         = new Label();
                m_zoomLabel.Content = "x 1";
                m_zoomLabel.Margin  = new Thickness(10, 5, 10, 5);
                m_topPanel.DockLeft(m_zoomLabel);

                m_posLabel = new Label();
                m_topPanel.DockLeft(m_posLabel);

                // m_testButton = Toolbox.CreateButton("Test", 50, OnTest, 5, 5);
                // m_topPanel.DockLeft(m_testButton);

                m_cropButton         = Toolbox.CreateButton("Crop", 38, OnCropDiagram, 5, 5);
                m_cropButton.ToolTip = "Crop diagram to current displayed time range.";

                m_undoButton           = Toolbox.CreateButton("Undo", 38, OnUndoCrop, 5, 5);
                m_undoButton.ToolTip   = "Restore last time range.";
                m_undoButton.IsEnabled = false;

                m_topPanel.DockRight(m_undoButton);
                m_topPanel.DockRight(m_cropButton);
            }

            // Left: DataGrid with Metrics, helpBox
            m_leftPanel = new DockPanel();
            {
                m_leftPanel.Width      = LeftPanelWidth;
                m_leftPanel.Background = Brushes.LightGray;

                m_metricGrid                     = new DataGrid();
                m_metricGrid.Background          = Brushes.LightGray;
                m_metricGrid.AutoGenerateColumns = false;
                m_metricGrid.IsReadOnly          = true;

                m_metricGrid.AddColumn("Metric", "Name", false);
                m_metricGrid.AddColumn("Value", "Value", true);

                m_leftLegend       = new StackPanel();
                m_leftLegend.Width = LegendWidth;

                m_leftPanel.DockRight(m_leftLegend);
                m_leftPanel.DockTop(m_metricGrid);
                m_leftPanel.DockTop(helpBox);
            }

            // Bottom-right: ScrollViewer with diagram
            m_scrollViewer = new ScrollViewer();
            {
                m_scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                m_scrollViewer.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
                m_scrollViewer.SizeChanged += OnSizeChange;

                m_tip = new ToolTip();
                m_scrollViewer.ToolTip = m_tip;

                ToolTipService.SetInitialShowDelay(m_scrollViewer, 500);
                ToolTipService.SetShowDuration(m_scrollViewer, 1000);
            }

            DockPanel heapDiagram = Toolbox.DockTopLeft(m_topPanel, m_leftPanel, m_scrollViewer);

            return(heapDiagram);
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: Gravicode/BMC.Hidroponic
        void setup()
        {
            //rnd = new Random();
            Display.Width = 800;

            Display.Height = 480;

            Display.HorizontalSyncPulseWidth = 1;

            Display.HorizontalBackPorch = 88;

            Display.HorizontalFrontPorch = 40;

            Display.VerticalSyncPulseWidth = 3;

            Display.VerticalBackPorch = 32;

            Display.VerticalFrontPorch = 13;

            Display.PixelClockRateKHz = 25000;

            Display.OutputEnableIsFixed = true;

            Display.OutputEnablePolarity = true;

            Display.HorizontalSyncPolarity = false;

            Display.VerticalSyncPolarity = false;

            Display.PixelPolarity = true;

            Display.Type = Display.DisplayType.Lcd;



            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }

            //init touch

            i2cDevice = new I2CDevice(new I2CDevice.Configuration(0x38, 400));

            CapDriver = new CapTouchDriver(i2cDevice);

            CapDriver.SetBacklightTime(0);

            CapDriver.ResetBacklight();


            //CapacitiveTouchController.Initialize(GHI.Pins.G120.P2_21);

            //CapacitiveTouchController.Initialize(GHI.Pins.FEZCobraII.Socket4.Pin3);

            GlideTouch.Initialize();

            MainWindow = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.Form1));
            //img = (GHI.Glide.UI.Image)MainWindow.GetChildByName("img");
            //btn = (GHI.Glide.UI.Button)MainWindow.GetChildByName("BtnChange");
            txt = (GHI.Glide.UI.TextBlock)MainWindow.GetChildByName("txtStatus");
            //GT.Picture pic = new GT.Picture(Resources.GetBytes(Resources.BinaryResources.empty), GT.Picture.PictureEncoding.JPEG);
            //img.Bitmap = pic.MakeBitmap();

            GvData = (DataGrid)MainWindow.GetChildByName("GvData");
            GvData.AddColumn(new DataGridColumn("Time", 100));
            GvData.AddColumn(new DataGridColumn("Temp 1", 100));
            GvData.AddColumn(new DataGridColumn("Temp 2", 100));
            GvData.AddColumn(new DataGridColumn("Water Dist", 100));
            GvData.AddColumn(new DataGridColumn("Tds 1", 100));
            GvData.AddColumn(new DataGridColumn("Tds 2", 100));

            Random rnd = new Random();

            counter = 0;


            Glide.MainWindow = MainWindow;
            //btn.ReleaseEvent += btn_ReleaseEvent;

            Glide.FitToScreen = true;

            //Thread th1 = new Thread(new ThreadStart(LoopButton));
            //th1.Start();
            //Mainboard.LDR0.OnInterrupt += LDR0_OnInterrupt;
            //Mainboard.LDR1.OnInterrupt += LDR1_OnInterrupt;
            //logs = new LogHelper(usbHost);


            xBeeAdapter.Configure(9600, SerialParity.None, SerialStopBits.One, 8, HardwareFlowControl.NotRequired);
            //StartLora();

            xBeeAdapter.Port.LineReceived += Port_LineReceived;
            GT.Timer timer = new GT.Timer(5000); // every second (1000ms)
            timer.Tick += timer_Tick;
            timer.Start();

            // Timeout 10 seconds
            int timeout = 1000 * 10;

            // Enable Watchdog
            GHI.Processor.Watchdog.Enable(timeout);

            // Start a time counter reset thread
            WDTCounterReset = new Thread(WDTCounterResetLoop);
            WDTCounterReset.Start();
            // Normally, you can read this flag ***ONLY ONCE*** on power up
            if (GHI.Processor.Watchdog.LastResetCause == GHI.Processor.Watchdog.ResetCause.Watchdog)
            {
                //logs.WriteLogs("reset by watchdog");
                Debug.Print("Watchdog did Reset");
            }
            else
            {
                //logs.WriteLogs("system reboot / start");
                Debug.Print("Reset switch or system power");
            }
        }
コード例 #13
0
 public void AddColumn(string Caption, string ColumnName, int Width)
 {
     Control.AddColumn(Caption, ColumnName, Width);
 }
コード例 #14
0
        private void Initialize_Components()
        {
            // window
            window           = new GHI.Glide.Display.Window("window_Fertilize", Window_Manager.Display_Width, Window_Manager.Display_Heigth);
            window.BackColor = Colors.White;

            // textBox_Header
            textBox_Header           = new TextBox("textBox_Header", 255, 120, 20, 270, 32);
            textBox_Header.Text      = "Pump Schedule";
            textBox_Header.TextAlign = 2;
            window.AddChild(textBox_Header);

            // textBox_Time
            textBox_Time           = new TextBox("textBox_Time", 255, 410, 20, 50, 32);
            textBox_Time.Text      = "--:--";
            textBox_Time.TextAlign = 2;
            window.AddChild(textBox_Time);

            // textBox_Back
            textBox_Back           = new TextBox("button_Back", 255, 20, 20, 80, 32);
            textBox_Back.Text      = "Back";
            textBox_Back.TextAlign = 2;
            textBox_Back.TapEvent += new OnTap(button_Back_TapEvent);
            window.AddChild(textBox_Back);

            // dropDown_PumpSelection
            dropDown_PumpSelection      = new Dropdown("dropDown_PumpSelection", 255, 120, 70, 270, 32);
            dropDown_PumpSelection.Text = "Select Pump";
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 1", 1 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 2", 2 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 3", 3 });
            dropDown_PumpSelection.Options.Add(new object[] { "Pump 4", 4 });
            dropDown_PumpSelection.TapEvent          += dropDown_PumpSelection_TapEvent;
            dropDown_PumpSelection.ValueChangedEvent += dropDown_PumpSelection_ValueChangedEvent;
            window.AddChild(dropDown_PumpSelection);

            // list_dropDown_PumpSelection
            list_dropDown_PumpSelection             = new List(dropDown_PumpSelection.Options, 4);
            list_dropDown_PumpSelection.CloseEvent += list_dropDown_PumpSelection_CloseEvent;

            // button_New
            button_New           = new Button("button_New", 255, 20, 70, 80, 32);
            button_New.Text      = "New";
            button_New.TapEvent += button_New_TapEvent;
            window.AddChild(button_New);

            // button_Delete
            button_Delete           = new Button("button_Delete", 255, 20, 120, 80, 32);
            button_Delete.Text      = "Delete";
            button_Delete.TapEvent += button_Delete_TapEvent;
            window.AddChild(button_Delete);

            // dataGrid_Schedule
            DataGridColumn dataGridColumn_StartTime    = new DataGridColumn("Start Time", 135);
            DataGridColumn dataGridColumn_Quantity     = new DataGridColumn("Quantity", 135);
            DataGridColumn dataGridColumn_FertilizeJob = new DataGridColumn("Job", 0);

            dataGrid_Schedule = new DataGrid("dataGrid_Schedule", 255, 120, 120, 270, 32, 4);
            dataGrid_Schedule.HeadersBackColor = Colors.LightGray;
            dataGrid_Schedule.HeadersFontColor = Colors.Black;
            dataGrid_Schedule.AddColumn(dataGridColumn_StartTime);
            dataGrid_Schedule.AddColumn(dataGridColumn_Quantity);
            dataGrid_Schedule.AddColumn(dataGridColumn_FertilizeJob);
            dataGrid_Schedule.TapCellEvent += dataGrid_Schedule_TapCellEvent;
            window.AddChild(dataGrid_Schedule);

            // textbox_StartTime
            textbox_StartTime                    = new TextBox("textbox_StartTime", 255, 20, 170, 80, 32);
            textbox_StartTime.TextAlign          = 3;
            textbox_StartTime.TapEvent          += textbox_StartTime_TapEvent;
            textbox_StartTime.ValueChangedEvent += textbox_StartTime_ValueChangedEvent;
            window.AddChild(textbox_StartTime);

            // textbox_Quantity
            textbox_Quantity                    = new TextBox("textbox_Quantity", 255, 20, 220, 80, 32);
            textbox_Quantity.TextAlign          = 3;
            textbox_Quantity.TapEvent          += textbox_Quantity_TapEvent;
            textbox_Quantity.ValueChangedEvent += textbox_Quantity_ValueChangedEvent;
            window.AddChild(textbox_Quantity);
        }
コード例 #15
0
 protected override void OnInitialized()
 {
     DataGrid?.AddColumn(this);
 }