private void Application_Startup(object sender, StartupEventArgs e) { var window = new MainWindow(); messageBox = new CustomMessageBox(); var fileHelper = new ImageFileHelper(this.GetBaseFolderLocation); var imageManger = new WordImageManager(messageBox, fileHelper); var captureWindow = new CaptureArea(); var captureAreaVM = new CaptureAreaVM(fileHelper, captureWindow); captureWindow.DataContext = captureAreaVM; // the idea behind passing parameters as function is delay the execution so that the boot time is faster window.DataContext = new MainVM(messageBox, fileHelper, () => { return(new WindowsHandler()); }, imageManger , window, captureAreaVM); window.Show(); //CaptureArea m = new CaptureArea() //{ // WindowStartupLocation = WindowStartupLocation.Manual, // WindowStyle = WindowStyle.None, // AllowsTransparency = true, // Background = (true ? new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)) : Brushes.WhiteSmoke) //}; //var color = Color.FromArgb(1, 0, 0, 0); //m.Show(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.captureAreaWindow = ((ScreenCapture.CaptureArea)(target)); #line 11 "..\..\CaptureArea.xaml" this.captureAreaWindow.Loaded += new System.Windows.RoutedEventHandler(this.OnWindowLoaded); #line default #line hidden #line 12 "..\..\CaptureArea.xaml" this.captureAreaWindow.KeyDown += new System.Windows.Input.KeyEventHandler(this.CaptureArea_KeyDownEvent); #line default #line hidden #line 13 "..\..\CaptureArea.xaml" this.captureAreaWindow.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Canvas_MouseDown); #line default #line hidden #line 13 "..\..\CaptureArea.xaml" this.captureAreaWindow.MouseMove += new System.Windows.Input.MouseEventHandler(this.canvasPlane_MouseMove); #line default #line hidden #line 13 "..\..\CaptureArea.xaml" this.captureAreaWindow.MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.canvasPlane_MouseUp); #line default #line hidden #line 13 "..\..\CaptureArea.xaml" this.captureAreaWindow.Activated += new System.EventHandler(this.captureAreaWindow_Activated); #line default #line hidden return; case 2: this.mainCanvas = ((System.Windows.Controls.StackPanel)(target)); return; case 3: this.canvasTop = ((System.Windows.Controls.Canvas)(target)); return; case 4: this.canvasDrawPane1 = ((System.Windows.Controls.StackPanel)(target)); return; case 5: this.canvasDrawPaneLeft = ((System.Windows.Controls.Canvas)(target)); return; case 6: this.canvasDrawPane = ((System.Windows.Controls.Canvas)(target)); return; case 7: this.canvasBorder = ((System.Windows.Controls.Border)(target)); return; case 8: this.canvasPanelRight = ((System.Windows.Controls.Canvas)(target)); return; case 9: this.canvasBottom = ((System.Windows.Controls.Canvas)(target)); return; case 10: this.controlsPanel = ((System.Windows.Controls.StackPanel)(target)); return; case 11: #line 68 "..\..\CaptureArea.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnHighlightButtonClick); #line default #line hidden return; } this._contentLoaded = true; }