void MainView_Loaded(object sender, RoutedEventArgs e) { resultControl = new ResultControl(); resultControl.Opacity = 0; this.MainGrid.Children.Add(resultControl); buttonBar = new ButtonBarControl(this.WebcamControl); this.MainGrid.Children.Add(buttonBar); }
public MovementBrain(ButtonBarControl buttonBar, System.Windows.Controls.Image displayImage) { int imageWidth = CaptureModel.Instance.Image.Width; int imageHeight = CaptureModel.Instance.Image.Height; this.buttons = buttonBar.getButtonPositions(); this.wRatio = displayImage.ActualWidth / imageWidth; this.hRatio = displayImage.ActualHeight / imageHeight; interestRectangleForButtons = new Rectangle(0, 0, imageWidth, Convert.ToInt32(100 / this.wRatio)); rectanglesForButtons=new Rectangle[buttons.GetLength(0)]; buttonPressedForButtonBar = new bool[buttons.GetLength(0)]; currentSteadyFramesForButtonBar = new int[buttons.GetLength(0)]; for(int i=0;i<buttons.GetLength(0);i++) { rectanglesForButtons[i]=new Rectangle(Convert.ToInt32(buttons[i,0]/this.wRatio),Convert.ToInt32(buttons[i,1]/this.wRatio),Convert.ToInt32((buttons[i,2]-buttons[i,0])/this.wRatio),Convert.ToInt32((buttons[i,3]-buttons[i,1])/this.wRatio)); } buttonAreaForButtonBar = getArea(rectanglesForButtons[0]); OnBarEvent(new PropertyChangedEventArgs("SIDEBAR,disable")); }