Пример #1
0
        ////////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////////
        private void LoadFileButton_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "";                                // Default file name
            dlg.DefaultExt = ".spe";                            // Default file extension
            dlg.Filter     = "LightField Data (*.spe)|*.spe";   // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Data Workspace
                if (selectedLocation_ == DisplayLocation.DataWorkspace)
                {
                    BuildDisplayControls(display_.DisplayFileInDataWorkspace(dlg.FileName));
                }
                // Data Workspace Comparison + Experiment
                else
                {
                    IDisplayViewer viewer = display_.GetDisplay(selectedLocation_, selectedIndex_);
                    viewer.Display(dlg.FileName);
                    BuildDisplayControls(viewer);
                }
            }
        }
Пример #2
0
        ////////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////////
        private void AddFileButton_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "";                                // Default file name
            dlg.DefaultExt = ".spe";                            // Default file extension
            dlg.Filter     = "LightField Data (*.spe)|*.spe";   // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Data Workspace
                if (selectedLocation_ != DisplayLocation.DataWorkspace)
                {
                    // Get the viewer
                    IDisplayViewer viewer = display_.GetDisplay(selectedLocation_, selectedIndex_);

                    // Must be a graph to add source
                    viewer.DisplayType = DisplayType.Graph;

                    // Only support a maximum of 5 sources
                    if (viewer.DisplaySources.Count < 5)
                    {
                        // Create the source and add it
                        IDisplaySource source = display_.Create(dlg.FileName);
                        viewer.Add(source);
                    }
                }
            }
        }
Пример #3
0
        ///////////////////////////////////////////////////////////////////////
        //  Make a linear ramp of data and display it.
        ///////////////////////////////////////////////////////////////////////
        private void GenerateRamps()
        {
            // Make A Frame 200x400 pixels
            ushort[] frame1 = new ushort[200 * 400];
            for (int pix = 0; pix < 200 * 400; pix++)
            {
                frame1[pix] = (ushort)(pix % 400);
            }

            // Make A Frame 300x500 pixels with a 1k bias
            ushort[] frame2 = new ushort[300 * 500];
            for (int pix = 0; pix < 300 * 500; pix++)
            {
                frame2[pix] = (ushort)((pix % 500) + 1000);
            }

            // Get the addin file manager
            var datamgr = LightFieldApplication.DataManager;

            if (datamgr != null)
            {
                RegionOfInterest roi  = new RegionOfInterest(0, 0, 400, 200, 1, 1);
                RegionOfInterest roi2 = new RegionOfInterest(0, 0, 500, 300, 1, 1);

                // Simple Single Region
                IImageDataSet imageData = datamgr.CreateImageDataSet(frame1, roi, ImageDataFormat.MonochromeUnsigned16);

                RegionOfInterest[] rois = { roi, roi2 };

                List <Array> buffers = new List <Array>();
                buffers.Add(frame1);
                buffers.Add(frame2);

                // Complex Set Containing Two Regions
                IImageDataSet imageDataSets = datamgr.CreateImageDataSet(buffers, rois, ImageDataFormat.MonochromeUnsigned16);

                IDisplay display = LightFieldApplication.DisplayManager;
                if (display != null)
                {
                    // Select Data File Compare Mode & 3 Vertical Windows
                    display.ShowDisplay(DisplayLocation.ExperimentWorkspace, DisplayLayout.TwoHorizontal);
                    IDisplayViewer view = null;

                    // Modify the underlying data a little bit before displaying it.
                    ModifyDataExample(imageData, 0);

                    // Put the simple data in window 0
                    view = display.GetDisplay(DisplayLocation.ExperimentWorkspace, 0);
                    view.Display("SimpleRamp", imageData);

                    // Modify the underlying data a little bit before displaying it.
                    ModifyDataExample(imageDataSets, 1);

                    // Put the complex data in window 1
                    view = display.GetDisplay(DisplayLocation.ExperimentWorkspace, 1);
                    view.Display("ComplexRamp", imageDataSets);
                }
            }
        }
Пример #4
0
        private void init(IDisplayViewer viewer)
        {
            rectForSourcePen = (Pen)Pens.Yellow.Clone();
            rectForSourcePen.Width = 2;

            EditStyle.AllowRotate = false;
            EditStyle.HideRotationHandle = true;
            EditStyle.HidePinPoint = true;
            this.EnableShading = true;
            this.EditStyle.AspectRatio = true;

            m_Viewer = viewer;

            m_Viewer.OnImageLoaded += new ImageChanged(m_Viewer_OnImageLoaded);
            m_Viewer.OnSourceSelected += new ImageChanged(m_Viewer_OnImageLoaded);
        }
Пример #5
0
        ///////////////////////////////////////////////////////////////////////
        // Show 4 Plots of Cos vs Sine in Quad Display
        // 1.) Generates Raw Data
        // 2.) Builds IImageData(s) with the raw data from the DataManager.
        // 3.) Gets 4 Displays and Puts 2 Waveforms in each display.
        ///////////////////////////////////////////////////////////////////////
        private void PlotSinAndCos()
        {
            // Make two curves (720 = 2*PI so its a full cycle)
            ushort[] cosine = new ushort[720];
            ushort[] sine   = new ushort[720];

            // Generate Curves (Amplitude 100)
            for (int pix = 0; pix < 720; pix++)
            {
                // Convert To Angle
                double angle = Math.PI * ((double)pix - 360) / 180.0;

                // Compute Points
                cosine[pix] = (ushort)((double)100 * (Math.Cos(angle) + (double)1));
                sine[pix]   = (ushort)((double)100 * (Math.Sin(angle) + (double)1));
            }

            // Get the data manager
            var datamgr = LightFieldApplication.DataManager;

            if (datamgr != null)
            {
                RegionOfInterest roi = new RegionOfInterest(0, 0, 720, 1, 1, 1);
                // Create Blobs
                IImageDataSet cosData  = datamgr.CreateImageDataSet(cosine, roi, ImageDataFormat.MonochromeUnsigned16);
                IImageDataSet sineData = datamgr.CreateImageDataSet(sine, roi, ImageDataFormat.MonochromeUnsigned16);

                // Get The Display Object
                IDisplay display = LightFieldApplication.DisplayManager;
                if (display != null)
                {
                    // Select Data File Compare Mode & 4 Even Windows
                    display.ShowDisplay(DisplayLocation.ExperimentWorkspace, DisplayLayout.FourEven);
                    IDisplayViewer view = null;

                    // Put the data in all 4 windows
                    for (int i = 0; i <= 3; i++)
                    {
                        view = display.GetDisplay(DisplayLocation.ExperimentWorkspace, i);
                        view.Display("Cosine", cosData);
                        IDisplaySource sinSource = display.Create("Sine", sineData);
                        view.Add(sinSource);
                    }
                }
            }
        }
Пример #6
0
 public void SelectDisplayView(IDisplayViewer view)
 {
     DisplayController.Instance.OnSelectedDisplayChanged -= Instance_OnSelectedDisplayChanged;
     DisplayController.Instance.ChangeSelectedDisplay(view.Display);
     DisplayController.Instance.OnSelectedDisplayChanged += Instance_OnSelectedDisplayChanged;
 }
Пример #7
0
 /// <summary>
 /// Удалить из внутренней коллекции DisplayViewer, связанный удаленным окошком
 /// </summary>
 /// <param name="viewer"></param>
 public void removeViewer(IDisplayViewer viewer)
 {
     m_Viewers.Remove(viewer.Name);
     DisplayController.Instance.ForceCheckDisplay(viewer.Name, false);
     PresentationController.Instance.NotifyMonitorListChanged(from pair in m_Viewers select pair.Value.Display);
 }
Пример #8
0
 public System.Drawing.Size getDefaultSize(IDisplayViewer viewer)
 {
     return new System.Drawing.Size((viewer as DisplayViewer).Display.Width, (viewer as DisplayViewer).Display.Height + MonitorRectangle.HEADER_HEIGHT);
 }
Пример #9
0
 public MonitorRectangle(IDisplayViewer viewer, float x, float y, float width, float height)
     : base(x, y, width, height)
 {
     init(viewer);
 }
Пример #10
0
 public MonitorRectangle(IDisplayViewer viewer, MonitorRectangle src)
     : base(src)
 {
     init(viewer);
 }
Пример #11
0
 public MonitorRectangle(IDisplayViewer viewer)
     : base(viewer.Pos)
 {
     init(viewer);
 }
Пример #12
0
        ////////////////////////////////////////////////////////////////////////////////////
        // Control Builder
        ////////////////////////////////////////////////////////////////////////////////////
        public void BuildDisplayControls(IDisplayViewer view)
        {
            // Nuke the children!
            dockPanel1.Children.Clear();

            // Can't create controls for a view if one does not exist
            if (view == null)
            {
                return;
            }

            // the current viewer is used in the callback handlers for the controls
            currentViewer_ = view;

            // Build Controls From Viable Settings
            ScrollViewer rootScroller = new ScrollViewer();
            StackPanel   rootStack    = new StackPanel();

            controls_ = new List <ControlWidget>();

            // Build Controls Up & Set the Current Value to Match the chosen view(Argument)

            // General
            controls_.Add(new ControlWidget("General", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("View Type", ControlWidgetType.ComboBox, view.DisplayType));

            // Zooming
            controls_.Add(new ControlWidget("Zooming", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("Zoom Out", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("Zoom In", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("Zoom", ControlWidgetType.SliderBar, view.Zoom, view.MinimumZoom, view.MaximumZoom));
            controls_.Add(new ControlWidget("ZoomToBestFit", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("ZoomToActualSize", ControlWidgetType.Button, 0));

            // Stamping
            controls_.Add(new ControlWidget("Stamping", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("Exposure Start", ControlWidgetType.CheckBox, view.ShowExposureStartedTimeStamp));
            controls_.Add(new ControlWidget("Exposure End", ControlWidgetType.CheckBox, view.ShowExposureEndedTimeStamp));
            controls_.Add(new ControlWidget("Frame Tracking Number", ControlWidgetType.CheckBox, view.ShowFrameTrackingNumber));
            controls_.Add(new ControlWidget("Absolute Time", ControlWidgetType.CheckBox, view.ShowTimeStampsInAbsoluteTime));
            controls_.Add(new ControlWidget("GateTracking Delay", ControlWidgetType.CheckBox, view.ShowGateTrackingDelay));
            controls_.Add(new ControlWidget("GateTracking Width", ControlWidgetType.CheckBox, view.ShowGateTrackingWidth));
            controls_.Add(new ControlWidget("Phase Modulation", ControlWidgetType.CheckBox, view.ShowModulationTrackingPhase));

            // Regions, Frames & Rows
            controls_.Add(new ControlWidget("Source,Frames,Regions,Rows", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("CurrentSource", ControlWidgetType.ComboBox, FromSource(view.DisplaySourceIndex)));
            controls_.Add(new ControlWidget("Frame", ControlWidgetType.SliderBar, view.FrameIndex, 0, view.Frames - 1));
            controls_.Add(new ControlWidget("Region", ControlWidgetType.SliderBar, view.RegionIndex, 0, view.Regions - 1));
            controls_.Add(new ControlWidget("Row", ControlWidgetType.SliderBar, view.RowIndex, 0, view.Rows - 1));

            // Playback
            controls_.Add(new ControlWidget("Playback", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("IsPlaybackRunning", ControlWidgetType.CheckBox, view.IsPlaybackRunning));
            controls_.Add(new ControlWidget("RepeatPlayback", ControlWidgetType.CheckBox, view.RepeatPlayback));
            controls_.Add(new ControlWidget("PlaybackFrameRate", ControlWidgetType.EditBox, view.PlaybackFrameRate));

            // Scaling
            controls_.Add(new ControlWidget("Scaling", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("OptimizeContrast", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("AutoScaleIntensity", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("AlwaysAutoScaleIntensity", ControlWidgetType.CheckBox, view.AlwaysAutoScaleIntensity));
            controls_.Add(new ControlWidget("BlackLevel", ControlWidgetType.EditBox, 0));
            controls_.Add(new ControlWidget("WhiteLevel", ControlWidgetType.EditBox, 0));
            controls_.Add(new ControlWidget("SetIntensityLevels", ControlWidgetType.Button, 0));

            // Graph Controls
            controls_.Add(new ControlWidget("Graph", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("GraphGridLines", ControlWidgetType.ComboBox, view.GraphGridLines));
            controls_.Add(new ControlWidget("PlottingStyle", ControlWidgetType.ComboBox, view.PlottingStyle));
            controls_.Add(new ControlWidget("PeaksIndicated", ControlWidgetType.ComboBox, view.PeaksIndicated));
            controls_.Add(new ControlWidget("PlotsStacked", ControlWidgetType.CheckBox, view.PlotsStacked));
            controls_.Add(new ControlWidget("DataPointsVisible", ControlWidgetType.CheckBox, view.DataPointsVisible));
            controls_.Add(new ControlWidget("GraphZoomMode", ControlWidgetType.ComboBox, view.GraphZoomMode));
            controls_.Add(new ControlWidget("ZoomXAxisToBestFit", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("ZoomYAxisToBestFit", ControlWidgetType.Button, 0));

            // Pseudo Color
            controls_.Add(new ControlWidget("PseudoColor", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("PseudoColorPalette", ControlWidgetType.ComboBox, view.PseudoColorPalette));

            // Cursors (Single Position)
            int   x = 0, y = 0;
            Point?p = view.CursorPosition;

            if (p != null)
            {
                x = (int)((Point)p).X;
                y = (int)((Point)p).Y;
            }

            // Cursor Box
            int  bx, by, bw, bh;
            Rect rect = view.DataSelection;

            bx = (int)rect.X;
            by = (int)rect.Y;
            bw = (int)rect.Width;
            bh = (int)rect.Height;

            if (bx < 0)
            {
                bx = 0;
            }
            if (by < 0)
            {
                by = 0;
            }
            if (bw < 0)
            {
                bw = 0;
            }
            if (bh < 0)
            {
                bh = 0;
            }

            controls_.Add(new ControlWidget("Cursors", ControlWidgetType.Expander, 0));
            controls_.Add(new ControlWidget("CursorStyle", ControlWidgetType.ComboBox, view.CursorStyle));
            controls_.Add(new ControlWidget("CrossSections", ControlWidgetType.ComboBox, view.CrossSections));
            controls_.Add(new ControlWidget("Point X", ControlWidgetType.EditBox, x));
            controls_.Add(new ControlWidget("Point Y", ControlWidgetType.EditBox, y));
            controls_.Add(new ControlWidget("Set Cursor", ControlWidgetType.Button, 0));
            controls_.Add(new ControlWidget("Box X", ControlWidgetType.EditBox, bx));
            controls_.Add(new ControlWidget("Box Y", ControlWidgetType.EditBox, by));
            controls_.Add(new ControlWidget("Box Width", ControlWidgetType.EditBox, bw));
            controls_.Add(new ControlWidget("Box Height", ControlWidgetType.EditBox, bh));
            controls_.Add(new ControlWidget("Set Region", ControlWidgetType.Button, 0));

            // Everything Else
            controls_.Add(new ControlWidget("Miscellaneous", ControlWidgetType.Expander, 0));

            // Start off Empty
            Stack <Expander>   expanderStack   = new Stack <Expander>();
            Stack <StackPanel> stackPanelStack = new Stack <StackPanel>();

            Grid grid   = null;
            int  rowIdx = 0;

            for (int i = 0; i < controls_.Count(); i++)
            {
                switch (controls_[i].GetWidgetType())
                {
                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.Button:
                {
                    if ((grid = NewGridNeeded(grid)) != null)
                    {
                        grid.RowDefinitions.Add(new RowDefinition());

                        Button btn = new Button();
                        controls_[i].ControlItem = btn;
                        btn.Name              = controls_[i].GetName().Replace(' ', '_');
                        btn.Content           = btn.Name;
                        btn.VerticalAlignment = VerticalAlignment.Center;
                        btn.Margin            = new Thickness(2, 2, 2, 2);
                        grid.Children.Add(btn);
                        Grid.SetRow(btn, rowIdx);
                        Grid.SetColumn(btn, 1);

                        // Text Block is common
                        TextBlock tb = new TextBlock()
                        {
                            Text = btn.Name
                        };
                        tb.TextWrapping = TextWrapping.Wrap;
                        grid.Children.Add(tb);
                        Grid.SetRow(tb, rowIdx);
                        Grid.SetColumn(tb, 0);

                        btn.Click += new RoutedEventHandler(btn_Click);

                        rowIdx++;
                    }
                }
                break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.CheckBox:
                {
                    if ((grid = NewGridNeeded(grid)) != null)
                    {
                        grid.RowDefinitions.Add(new RowDefinition());

                        CheckBox cb = new CheckBox();
                        controls_[i].ControlItem = cb;
                        cb.Margin              = new Thickness(2, 2, 2, 2);
                        cb.IsChecked           = (bool)controls_[i].GetValue();
                        cb.HorizontalAlignment = HorizontalAlignment.Center;
                        cb.VerticalAlignment   = VerticalAlignment.Center;
                        cb.Name = controls_[i].GetName().Replace(' ', '_');
                        grid.Children.Add(cb);
                        Grid.SetRow(cb, rowIdx);
                        Grid.SetColumn(cb, 1);

                        cb.Click += new RoutedEventHandler(cb_Click);

                        // Text Block is common
                        TextBlock tb = new TextBlock()
                        {
                            Text = cb.Name
                        };
                        tb.TextWrapping = TextWrapping.Wrap;
                        grid.Children.Add(tb);
                        Grid.SetRow(tb, rowIdx);
                        Grid.SetColumn(tb, 0);

                        rowIdx++;
                    }
                }
                break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.ComboBox:
                {
                    if ((grid = NewGridNeeded(grid)) != null)
                    {
                        grid.RowDefinitions.Add(new RowDefinition());
                        ComboBox cb = new ComboBox();
                        controls_[i].ControlItem = cb;
                        cb.VerticalAlignment     = VerticalAlignment.Center;
                        cb.Margin = new Thickness(2, 2, 2, 2);
                        cb.Name   = controls_[i].GetName().Replace(' ', '_');
                        grid.Children.Add(cb);
                        Grid.SetRow(cb, rowIdx);
                        Grid.SetColumn(cb, 1);

                        // Using reflection add all of the enums
                        string[] enumStrings = Enum.GetNames(controls_[i].GetValue().GetType());
                        foreach (string s in enumStrings)
                        {
                            if (s != "UninitializedEnum")
                            {
                                cb.Items.Add(s);
                            }
                        }
                        cb.SelectedItem      = controls_[i].GetValue().ToString();
                        cb.SelectionChanged += new SelectionChangedEventHandler(cb_SelectionChanged);

                        // Text Block is common
                        TextBlock tb = new TextBlock()
                        {
                            Text = cb.Name
                        };
                        tb.TextWrapping = TextWrapping.Wrap;
                        grid.Children.Add(tb);
                        Grid.SetRow(tb, rowIdx);
                        Grid.SetColumn(tb, 0);

                        rowIdx++;
                    }
                }
                break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.EditBox:
                {
                    if ((grid = NewGridNeeded(grid)) != null)
                    {
                        grid.RowDefinitions.Add(new RowDefinition());
                        TextBox cb = new TextBox();
                        controls_[i].ControlItem = cb;
                        cb.Margin            = new Thickness(2, 2, 2, 2);
                        cb.Text              = controls_[i].GetValue().ToString();
                        cb.TextAlignment     = TextAlignment.Right;
                        cb.VerticalAlignment = VerticalAlignment.Center;
                        cb.Height            = 25;

                        grid.Children.Add(cb);         // Right Before Global Calls
                        Grid.SetRow(cb, rowIdx);
                        Grid.SetColumn(cb, 1);
                        cb.LostFocus += new RoutedEventHandler(cb_LostFocus);
                        cb.Name       = controls_[i].GetName().Replace(' ', '_');

                        // Text Block is common
                        TextBlock tb = new TextBlock()
                        {
                            Text = cb.Name
                        };
                        tb.TextWrapping = TextWrapping.Wrap;
                        grid.Children.Add(tb);
                        Grid.SetRow(tb, rowIdx);
                        Grid.SetColumn(tb, 0);

                        rowIdx++;
                    }
                }
                break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.Expander:
                {
                    // Pop And Link
                    if ((stackPanelStack.Count() > 0) && (expanderStack.Count() > 0))
                    {
                        Expander   expander   = expanderStack.Pop();
                        StackPanel stackpanel = stackPanelStack.Pop();

                        expander.Content = grid;

                        // If Zero its added already
                        if (stackPanelStack.Count() != 0)
                        {
                            stackpanel.Children.Add(expander);
                        }

                        // The Grid is done
                        grid = null;
                    }

                    var sp = new StackPanel();
                    var xp = new Expander();


                    stackPanelStack.Push(sp);
                    expanderStack.Push(xp);

                    xp.Header          = controls_[i].GetName();
                    xp.BorderThickness = new Thickness(1);
                    xp.BorderBrush     = Brushes.Black;
                    xp.FlowDirection   = FlowDirection.LeftToRight;

                    // Add To Root
                    if (stackPanelStack.Count == 1)
                    {
                        rootStack.Children.Add(xp);
                    }

                    // Reset Control Count For Grid
                    rowIdx = 0;
                }
                break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.ReadOnlyEditBox:
                    break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.SliderBar:
                    if ((grid = NewGridNeeded(grid)) != null)
                    {
                        grid.RowDefinitions.Add(new RowDefinition());
                        Slider sld = new Slider();
                        sld.Margin = new Thickness(2, 2, 2, 2);
                        controls_[i].ControlItem = sld;
                        sld.Name = controls_[i].GetName().Replace(' ', '_');
                        sld.VerticalAlignment = VerticalAlignment.Center;

                        grid.Children.Add(sld);
                        Grid.SetRow(sld, rowIdx);
                        Grid.SetColumn(sld, 1);

                        sld.Minimum = controls_[i].SliderMin();
                        sld.Maximum = controls_[i].SliderMax();
                        if (sld.Maximum == sld.Minimum)
                        {
                            sld.IsEnabled = false;
                        }

                        sld.Value         = Convert.ToDouble(controls_[i].GetValue());
                        sld.ValueChanged += new RoutedPropertyChangedEventHandler <double>(sld_ValueChanged);

                        // Text Block is common
                        TextBlock tb = new TextBlock()
                        {
                            Text = sld.Name
                        };
                        tb.TextWrapping = TextWrapping.Wrap;
                        grid.Children.Add(tb);
                        Grid.SetRow(tb, rowIdx);
                        Grid.SetColumn(tb, 0);

                        rowIdx++;
                    }
                    break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.SubEnd:
                {
                    // Pop And Link
                    if ((stackPanelStack.Count() > 0) && (expanderStack.Count() > 0))
                    {
                        Expander   expander   = expanderStack.Pop();
                        StackPanel stackpanel = stackPanelStack.Pop();

                        expander.Content = grid;

                        // If Zero its added already
                        if (stackPanelStack.Count() != 0)
                        {
                            stackpanel.Children.Add(expander);
                        }

                        // The Grid is done
                        grid = null;
                    }
                }
                break;

                ////////////////////////////////////////////////////////////////////////////////
                case ControlWidgetType.SubExpander:
                {
                    // Reset Control Count For Grid
                    rowIdx = 0;

                    var sp = new StackPanel();
                    var xp = new Expander();

                    stackPanelStack.Push(sp);
                    expanderStack.Push(xp);

                    xp.Header = controls_[i].GetName();
                    sp.Children.Add(xp);
                    sp.Background = Brushes.Beige;

                    xp.BorderThickness = new Thickness(1);
                    xp.BorderBrush     = Brushes.Black;
                    xp.FlowDirection   = FlowDirection.LeftToRight;

                    Thickness thickness = new Thickness(20, 2, 2, 2);
                    sp.SetValue(StackPanel.MarginProperty, thickness);
                }
                break;
                }
            }
            rootScroller.Content = rootStack;
            dockPanel1.Children.Add(rootScroller);
        }
Пример #13
0
 private void m_Controller_OnSelectedDisplayChanged(IDisplayViewer viewer)
 {
     this.diagram1.Controller.SelectionList.Clear();
     Node child = (from Node node in this.model1.Nodes where (node as MonitorRectangle).DisplayViewer.Name == viewer.Name select node).FirstOrDefault();
     this.diagram1.Controller.SelectionList.Add(child);
 }
Пример #14
0
 void m_Controller_OnViewerRemoved(IDisplayViewer viewer)
 {
     Node child = (from Node node in this.model1.Nodes where (node as MonitorRectangle).DisplayViewer.Name == viewer.Name select node).FirstOrDefault();
     if (child != null)
         this.model1.RemoveChild(child);
     this.Refresh();
 }
Пример #15
0
 void m_Controller_OnViewerAdded(IDisplayViewer viewer)
 {
     transformViewer(viewer);
     this.model1.AppendChild(new MonitorRectangle(viewer) { Diagram = this.diagram1 });
     this.Refresh();
     m_Controller.SelectDisplayView(viewer);
 }
Пример #16
0
 void transformViewer(IDisplayViewer viewer, float zoom)
 {
     if (!viewer.IsTransformed)
     {
         viewer.Pos = new Rectangle(viewer.Pos.Location, new Size((int)(viewer.Pos.Width * zoom), (int)(viewer.Pos.Height * zoom)));
     }
     else
         viewer.IsTransformed = false;
 }
Пример #17
0
 void transformViewer(IDisplayViewer viewer)
 {
     transformViewer(viewer, getZoom());
 }