public VectorListItem(MainControlVM mainControlVM, CanvasVector canvasVector) { this.InitializeComponent(); this._mainControlVM = mainControlVM; this._canvasVector = canvasVector; this.InputVectorColour.Background = this._canvasVector.VectorBrush; this.InputVectorX.Text = $"{this._canvasVector.X}"; this.InputVectorY.Text = $"{this._canvasVector.Y}"; }
//public CoordinateSystem() { // this.InitializeComponent(); // this._coordinateSystemVM = new CoordinateSystemVM(this._mainControlVM, this.CoordinateCanvas); // this.DataContext = this._coordinateSystemVM; // this.Loaded += delegate { this._coordinateSystemVM.Update(); }; // this.CoordinateCanvas.SizeChanged += delegate { this._coordinateSystemVM.Update(); }; // this.CoordinateCanvas.Loaded += delegate { Keyboard.Focus(this.CoordinateCanvas); }; //} public CoordinateSystem(MainControlVM mainControlVM, CoordinateSystemData data, List <CanvasVector> vectors = null) { this.InitializeComponent(); this._mainControlVM = mainControlVM; this._coordinateSystemVM = new CoordinateSystemVM(this._mainControlVM, this.CoordinateCanvas, data, vectors); this.DataContext = this._coordinateSystemVM; this.Loaded += delegate { this._coordinateSystemVM.Update(); }; this.CoordinateCanvas.SizeChanged += delegate { this._coordinateSystemVM.Update(); }; this.CoordinateCanvas.Loaded += delegate { Keyboard.Focus(this.CoordinateCanvas); }; }
public void LoadView(ViewType typeView) { switch (typeView) { case ViewType.Main: //загружаем вьюшку, ее вьюмодель MainWindowVM mainWindowVM = new MainWindowVM(idUser); MainWindow mainWindow = new MainWindow(); mainWindowVM.CodeBehind = mainWindow; mainWindow.DataContext = mainWindowVM; MainControl view = new MainControl(); MainControlVM vm = new MainControlVM(idUser); view.DataContext = vm; //отображаем this.ContentPresenterOutput.Content = view; break; case ViewType.AddBalance: //загружаем вьюшку, ее вьюмодель AddBalance addBalanceView = new AddBalance(); AddBalanceVM AddBalanceVm = new AddBalanceVM(idUser); addBalanceView.DataContext = AddBalanceVm; //отображаем this.ContentPresenterOutput.Content = addBalanceView; break; case ViewType.CallAndSms: //загружаем вьюшку, ее вьюмодель CallAndSms callAndSmsView = new CallAndSms(); CallAndSmsVM callAndSmsVm = new CallAndSmsVM(idUser, this); callAndSmsView.DataContext = callAndSmsVm; //отображаем this.ContentPresenterOutput.Content = callAndSmsView; break; case ViewType.Tariff: //загружаем вьюшку, ее вьюмодель Tariff tariffview = new Tariff(); TariffVM tariffVm = new TariffVM(idUser); tariffview.DataContext = tariffVm; //отображаем this.ContentPresenterOutput.Content = tariffview; break; case ViewType.Service: //загружаем вьюшку, ее вьюмодель Service serviceView = new Service(); ServiceVM serviceVM = new ServiceVM(idUser); serviceView.DataContext = serviceVM; //отображаем this.ContentPresenterOutput.Content = serviceView; break; case ViewType.CreateCall: //загружаем вьюшку, ее вьюмодель CreateCall callView = new CreateCall(); CreateCallVM callVM = new CreateCallVM(idUser, this); callView.DataContext = callVM; //отображаем this.ContentPresenterOutput.Content = callView; break; case ViewType.CreateSms: //загружаем вьюшку, ее вьюмодель CreateSms smsView = new CreateSms(); CreateSmsVM smsVM = new CreateSmsVM(idUser, this); smsView.DataContext = smsVM; //отображаем this.ContentPresenterOutput.Content = smsView; break; /*case ViewType.CheckListForPdf: * //загружаем вьюшку, ее вьюмодель * CheckListForPdf CheckListForPdfView = new CheckListForPdf(); * CheckListForPdfVM checkListForPdfVM = new CheckListForPdfVM(idUser,Convert.ToDateTime("01.01.2000"), Convert.ToDateTime("01.01.2020")); * //checkListForPdfVM.CodeBehind = CheckListForPdfView; * CheckListForPdfView.DataContext = checkListForPdfVM; * CheckListForPdfView.Show(); *//* //отображаем * this.ContentPresenterOutput.Content = CheckListForPdfView;*//* * break;*/ } }
public MainControl() { this.InitializeComponent(); this._vm = new MainControlVM(this); this.DataContext = this._vm; }