예제 #1
1
        public GraphViewController (ExampleInfo exampleInfo)
        {
            this.exampleInfo = exampleInfo;
			this.plotView = new PlotView ();
			this.plotView.Model = exampleInfo.PlotModel;
        }
예제 #2
0
		public GraphScrollView (ExampleInfo exampleInfo, RectangleF rect)
			: base(rect)
		{
			ShowsVerticalScrollIndicator = true;
			ShowsHorizontalScrollIndicator = true;
			BouncesZoom = true;
			PagingEnabled = false;
			DecelerationRate = UIScrollView.DecelerationRateNormal;
			BackgroundColor = UIColor.DarkGray;
			MaximumZoomScale = 5f;
			MinimumZoomScale = 1f;
			ContentSize = new SizeF(rect.Size.Width * 5, rect.Size.Height * 5);

			var image = new UIImageView(new GraphView(exampleInfo).GetImage(rect));

			AddSubview(image);

			this.ViewForZoomingInScrollView = delegate(UIScrollView scrollView) {
				return image;
			};
		}
예제 #3
0
 public void SetExample (ExampleInfo example)
 {
     this.plotWindowController.SetExample (example);
     this.currentExample = example;
 }
		public GraphViewPage (ExampleInfo exampleInfo)
		{
			var opv = new OxyPlotView {
				WidthRequest = 300,
				HeightRequest = 300,
			};
			opv.Model = exampleInfo.PlotModel;

			var label = new Label {
				Text = "Category: " + exampleInfo.Category,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			bool GameOfLife = exampleInfo.Title.Contains ("Conway");
			if (!GameOfLife) {
				Content = new StackLayout {
					BackgroundColor = Color.White,
					Orientation = StackOrientation.Vertical,
					VerticalOptions = LayoutOptions.StartAndExpand,
					Children = {
						opv,
						label
					}
				};
			} else {

				var stepButton = new Button {
					Text = "step"
				};
				stepButton.Clicked += (sender, e) => {
					var ea = new OxyMouseDownEventArgs ();
					ea.ChangedButton = OxyMouseButton.Left;
					ea.Position = new ScreenPoint (150, 150);
					opv.Model.HandleMouseDown (this, ea);
					opv.InvalidateDisplay ();
				};


				var startButton = new Button {
					Text = "run"
				};
				startButton.Clicked += (sender, e) => {
					if (!keepRunning) {
						keepRunning = true;
						Device.StartTimer (new TimeSpan (0, 0, 0, 0, 200), () => {
							var ea = new OxyMouseDownEventArgs ();
							ea.ChangedButton = OxyMouseButton.Left;
							ea.Position = new ScreenPoint (150, 150);
							opv.Model.HandleMouseDown (this, ea);
							Device.BeginInvokeOnMainThread(() => {
								opv.InvalidateDisplay ();
							});
							return keepRunning;
						});
					}
				};
				var stopButton = new Button {
					Text = "stop"
				};
				stopButton.Clicked += (sender, e) => {
					keepRunning = false;
				};

				Content = new StackLayout {
					Orientation = StackOrientation.Vertical,
					VerticalOptions = LayoutOptions.FillAndExpand,
					Children = {
						opv,
						label,
						new StackLayout {
							HorizontalOptions = LayoutOptions.Center,
                            VerticalOptions = LayoutOptions.StartAndExpand,
							Orientation = StackOrientation.Horizontal,
                            Children = { stepButton, startButton, stopButton }
						}

					}
				};
			}
		}
예제 #5
0
		private void GraphView(ExampleInfo exampleInfo)
		{
			var dvc = new GraphViewController (exampleInfo);
			navigation.PushViewController (dvc, true);
		}
예제 #6
0
        private void InitializeComponent()
        {
            this.plotView1 = new OxyPlot.GtkSharp.PlotView();
            this.plotView1.SetSizeRequest(625, 554);

            this.treeView1 = new TreeView();
            this.treeView1.SetSizeRequest(314, 554);
            this.treeView1.Visible = true;

            var treeModel = new TreeStore(typeof(string), typeof(string));
            var iter = new TreeIter();
            string last = null;
            foreach (var ex in this.Examples)
            {
                if (last == null || last != ex.Category)
                {
                    iter = treeModel.AppendValues(ex.Category);
                    last = ex.Category;
                }

                treeModel.AppendValues(iter, ex.Title);
            }

            this.treeView1.Model = treeModel;
            var exampleNameColumn = new TreeViewColumn { Title = "Example" };
            var exampleNameCell = new CellRendererText();
            exampleNameColumn.PackStart(exampleNameCell, true);
            this.treeView1.AppendColumn(exampleNameColumn);
            exampleNameColumn.AddAttribute(exampleNameCell, "text", 0);

            this.treeView1.Selection.Changed += (s, e) =>
            {
                TreeIter selectedNode;
                TreeModel selectedModel;
                if (treeView1.Selection.GetSelected(out selectedModel, out selectedNode))
                {
                    string val1 = (string)selectedModel.GetValue(selectedNode, 0);
                    string val2 = (string)selectedModel.GetValue(selectedNode, 1);

                    var info = this.Examples.FirstOrDefault(ex => ex.Title == val1);
                    if (info != null)
                    {
                        this.SelectedExample = info;
                    }
                }
            };

            this.hbox1 = new HBox(false, 6);
            this.hbox1.SetSizeRequest(943, 554);

            this.hbox1.PackStart(this.treeView1, false, false, 6);
            this.hbox1.PackStart(this.plotView1, false, false, 6);

            this.Add(this.hbox1);

            //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            //this.AutoScaleMode = Gtk.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(943, 554);
            this.Title = "OxyPlot.GtkSharp Example Browser";
            this.DeleteEvent += (s, a) =>
            {
                Application.Quit();
                a.RetVal = true;
            };
        }
예제 #7
0
 public void SetExample(ExampleInfo example){
     this.Window.Title = example.Title;
     plotView.Model = example.PlotModel;
     plotView.Controller = example.PlotController;
     plotView.InvalidatePlot (true);
 }
		private void GraphView(ExampleInfo exampleInfo)
		{
			RectangleF plotFrame = UIScreen.MainScreen.Bounds;
			if (UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeLeft || UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeRight) {
				plotFrame = new RectangleF(0f,0f,UIScreen.MainScreen.ApplicationFrame.Height,UIScreen.MainScreen.ApplicationFrame.Width-navigation.NavigationBar.Bounds.Height);
			} else {
				plotFrame = new RectangleF(0f,0f,UIScreen.MainScreen.ApplicationFrame.Width,UIScreen.MainScreen.ApplicationFrame.Height-navigation.NavigationBar.Bounds.Height);
			}


			var graph_controller = new GraphViewController (exampleInfo.PlotModel, plotFrame);
			navigation.PushViewController (graph_controller, true);
		}
예제 #9
0
        private void InitializeComponent()
        {
            this.plotView = new OxyPlot.GtkSharp.PlotView();
            this.plotView.SetSizeRequest(300, 300);

            this.treeView = new TreeView();
            this.treeView.Visible = true;

            var treeModel = new TreeStore(typeof(string), typeof(string));
            var iter = new TreeIter();
            string last = null;
            foreach (var ex in this.Examples)
            {
                if (last == null || last != ex.Category)
                {
                    iter = treeModel.AppendValues(ex.Category);
                    last = ex.Category;
                }

                treeModel.AppendValues(iter, ex.Title, ex.Category);
            }

            this.treeView.Model = treeModel;
            var exampleNameColumn = new TreeViewColumn { Title = "Example" };
            var exampleNameCell = new CellRendererText();
            exampleNameColumn.PackStart(exampleNameCell, true);
            this.treeView.AppendColumn(exampleNameColumn);
            exampleNameColumn.AddAttribute(exampleNameCell, "text", 0);

            this.treeView.Selection.Changed += (s, e) =>
            {
                TreeIter selectedNode;
                TreeModel selectedModel;
                if (treeView.Selection.GetSelected(out selectedModel, out selectedNode))
                {
                    string val1 = (string)selectedModel.GetValue(selectedNode, 0);
                    string val2 = (string)selectedModel.GetValue(selectedNode, 1);

                    this.SelectedExample = this.Examples.FirstOrDefault(ex => ex.Category == val2 && ex.Title == val1);
                }
            };

            var scrollwin = new ScrolledWindow ();
            scrollwin.Add (this.treeView);
            scrollwin.SetSizeRequest(250, 300);

            var txtSearch = new Entry ();
            treeView.SearchEntry = txtSearch;
            var treeVbox = new VBox (false, 0);
            treeVbox.BorderWidth = 6;
            treeVbox.PackStart (txtSearch, false, true, 0);
            treeVbox.PackStart (scrollwin, true, true, 0);

            this.paned = new HPaned ();
            this.paned.Pack1 (treeVbox, false, false);
            this.paned.Pack2 (this.plotView, true, false);
            this.paned.Position = 300;

            this.Add(this.paned);

            //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            //this.AutoScaleMode = Gtk.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(943, 554);
            this.Title = "OxyPlot.GtkSharp Example Browser";
            this.DeleteEvent += (s, a) =>
            {
                Application.Quit();
                a.RetVal = true;
            };
        }
예제 #10
0
		public GraphView (ExampleInfo exampleInfo)
		{
			this.exampleInfo = exampleInfo;
		}
		public GraphViewController (ExampleInfo exampleInfo)
		{
			this.exampleInfo = exampleInfo;
		}