public void previewUpdate() { { //ovpSettings.polyList.Clear(); lock (previewPoly) { ovpSettings.addPolygon(previewPoly.ToArray(), new Color(0, 0.5f, 0), 0.7f, false); } viewport.updateViewport(); double progress = (double)currentProgress / (double)numberOfCases; statusLine.Text = (progress * 100).ToString("#.##") + "% complete"; progressBar.Value = currentProgress; // * 100.0f; } }
public MainForm() { myList = new List <ObservableCollection <string> >(); myList.Add(new ObservableCollection <string> { "First", "Second" }); DataContext = new myStuff { entries = myList }; refPoly = new PointF[5]; refPoly[0] = new PointF(-50, 50); refPoly[1] = new PointF(50, 50); refPoly[2] = new PointF(50, -50); refPoly[3] = new PointF(-50, -50); refPoly[4] = refPoly[0]; drawingLock = new object(); MinimumSize = new Size(200, 200); updateSimUIMTFunc = updateSimUIMT_; configureProgressBarFunc = configureProgressBar_; numberOfCases = 25000; timer_interval = 10; ovpSettings = new OVPSettings(); ovp2Settings = new OVPSettings(); ovp2Settings.zoomFactor = 3; Title = "My Eto Form"; /* * Test flags. * 0 : stamdard viewports in splitter test. * 1 : viewports in tabs (WPF has issues here due to the deferred evaluation; still need a better fix) * 3 : single viewport in panel, dropdown switches out the view settings. */ int mode = 0; if (mode == 0) { viewport = new TestViewport(ref ovpSettings); viewport.Size = new Size(250, 250); viewport2 = new TestViewport(ref ovp2Settings); viewport2.Size = new Size(200, 200); Panel testing = new Panel(); testing.Size = new Size(viewport.Width + viewport2.Width, viewport.Height); testing.Content = new Splitter { Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.None, Panel1 = viewport, Panel2 = viewport2 }; Panel testing2 = new Panel(); testing2.Content = new Splitter { Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.None, Panel1 = statusLine, Panel2 = progressBar }; testComboBox_SelEntry = new Button(); testComboBox_SelEntry.Text = "Change"; testComboBox_SelEntry.Click += changeSelEntry; testComboBox = new DropDown(); testComboBox.DataContext = DataContext; testComboBox.BindDataContext(c => c.DataStore, (myStuff m) => m.entries[0]); testComboBox.SelectedIndex = 0; //testComboBox.SelectedIndexBinding.BindDataContext((myStuff m) => m.index); Panel testing3 = new Panel(); testing3.Content = new Splitter { Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.None, Panel1 = testComboBox_SelEntry, Panel2 = testComboBox }; Panel testing4 = new Panel(); testing4.Content = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.None, Panel1 = testing3, Panel2 = testing }; Splitter mySplitter = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.None, Panel1 = testing4, Panel2 = testing2 }; Content = mySplitter; } if (mode == 1) { TabControl tabControl_main = new TabControl(); tabControl_main.Size = new Size(300, 300); Content = tabControl_main; TabPage tab_0 = new TabPage(); tab_0.Text = "0"; tabControl_main.Pages.Add(tab_0); PixelLayout tabPage_0_content = new PixelLayout(); tabPage_0_content.Size = new Size(280, 280); TabPage tab_1 = new TabPage(); tab_1.Text = "1"; tabControl_main.Pages.Add(tab_1); PixelLayout tabPage_1_content = new PixelLayout(); tabPage_1_content.Size = new Size(280, 280); tab_1.Content = tabPage_1_content; TabPage tab_2 = new TabPage(); tab_2.Text = "2"; tabControl_main.Pages.Add(tab_2); viewport = new TestViewport(ref ovpSettings); viewport.Size = new Size(200, 200); tabPage_1_content.Add(viewport, 5, 5); viewport2 = new TestViewport(ref ovp2Settings); viewport2.Size = new Size(200, 200); tab_2.Content = viewport2; } if (mode == 2) { ovpSettings.addPolygon(refPoly, Color.FromArgb(0, 255, 0), 0.7f, false); ovp2Settings.addPolygon(refPoly, Color.FromArgb(255, 0, 0), 0.7f, false); vSettings = new OVPSettings(); viewport = new TestViewport(ref vSettings); viewport.Size = new Size(250, 250); Panel testing = new Panel(); testing.Size = new Size(viewport.Width, viewport.Height); PixelLayout p = new PixelLayout(); p.Add(viewport, 0, 0); testing.Content = p; testComboBox_SelEntry = new Button(); testComboBox_SelEntry.Text = "Change"; testComboBox_SelEntry.Click += changeSelEntry; testComboBox = new DropDown(); testComboBox.DataContext = DataContext; testComboBox.BindDataContext(c => c.DataStore, (myStuff m) => m.entries[0]); testComboBox.SelectedIndex = 0; testComboBox.SelectedIndexChanged += adjustView_; //testComboBox.SelectedIndexBinding.BindDataContext((myStuff m) => m.index); var testing3 = new Splitter { Orientation = Orientation.Horizontal, FixedPanel = SplitterFixedPanel.None, Panel1 = testComboBox_SelEntry, Panel2 = testComboBox }; var testing4 = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.None, Panel1 = testing3, Panel2 = testing }; var mySplitter = new Splitter { Orientation = Orientation.Vertical, FixedPanel = SplitterFixedPanel.None, Panel1 = testing4, Panel2 = new Panel() }; Content = mySplitter; } statusLine = new Label(); statusLine.Size = new Size(150, 11); statusLine.Text = "Hello world"; progressBar = new ProgressBar(); progressBar.Height = 15; progressBar.MaxValue = numberOfCases; // create a few commands that can be used for the menu and toolbar var clickMe = new Command { MenuText = "Run", ToolBarText = "Run" }; clickMe.Executed += runCases; var abort = new Command { MenuText = "Abort", ToolBarText = "Abort" }; abort.Executed += abortTheRun; var adjustList = new Command { MenuText = "Add to list", ToolBarText = "Add" }; if (mode != 3) { adjustList.Executed += adjustList_; } var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q }; quitCommand.Executed += (sender, e) => Application.Instance.Quit(); var aboutCommand = new Command { MenuText = "About..." }; aboutCommand.Executed += (sender, e) => MessageBox.Show(this, "About my app..."); // create menu Menu = new MenuBar { Items = { // File submenu new ButtonMenuItem { Text = "&File", Items ={ clickMe } }, // new ButtonMenuItem { Text = "&Edit", Items = { /* commands/items */ } }, // new ButtonMenuItem { Text = "&View", Items = { /* commands/items */ } }, }, ApplicationItems = { // application (OS X) or file menu (others) new ButtonMenuItem { Text = "&Preferences..." }, }, QuitItem = quitCommand, AboutItem = aboutCommand }; // create toolbar ToolBar = new ToolBar { Items = { clickMe, abort, adjustList } }; //mySplitter.Panel1.SizeChanged += splitterSize; //mySplitter.Panel2.SizeChanged += splitterSize; }