/// <summary> /// Биндинг текстового бокса. /// </summary> private IUserControlController BindTextBox(PropertyInfo propertyInfo, IControlDescriptor control) { var controller = new TextBoxController(); controller.SetView((TextBoxControl)control); ProcessCommon(controller.Model, propertyInfo); var attr = GetAttribute <RegexValueAttribute>(propertyInfo); if (attr != null) { controller.Model.RegexText = attr.Regex; } return(controller); }
/// <summary> /// Инициализация данных контроллера. /// </summary> public override void Initialize() { _orderModel = ClientCore.Instance.CreateInstance <RepairOrderViewModel>(); _orderModel.Orders = new ObservableCollection <RepairOrderItemModel>(); _orderModel.CurrentWorkItems = new ObservableCollection <WorkItemModel>(); _orderModel.CurrentDeviceItems = new ObservableCollection <DeviceItemModel>(); _orderModel.CurrentOrderTimelineItems = new ObservableCollection <OrderTimelineModel>(); _view = new RepairOrderView { DataContext = _orderModel }; _paginatorController = new PaginatorController(); _paginatorController.SetView(_view.paginatorPanel, MaxPages, ItemsPerPage); _paginatorController.PageChanged += PaginatorControllerPageChanged; _filterBox = new RepairOrderFilterComboBoxController(); _filterBox.SetView(_view.filterBox, null, true, false); _userBox = new UserComboBoxController(); _userBox.SetView(_view.userBox, null, true, true); _statusBox = new OrderStatusController(); _statusBox.SetView(_view.statusBox, null, true, true); _nameBox = new TextBoxController(); _nameBox.SetView(_view.nameBox); _view.listView.SelectionChanged += RepairOrderListSelectionChanged; _view.listView.MouseDoubleClick += ListViewOnMouseDoubleClick; _view.editOrderItem.Click += (sender, args) => SelectedRepairOrderStartEdit(); _view.deleteOrderItem.Click += (sender, args) => SelectedRepairOrderStartDelete(); _view.createButton.Click += (sender, args) => RepairOrderStartCreate(); _nameBox.Model.PressKey += NameBoxOnPressKey; _view.updateButton.Click += (sender, args) => StartUpdateOrderList(1); _orderDataController = new RepairOrderDataController(); _orderDataController.Initialize(); _orderDataController.CreateModelSaved += OrderDataControllerCreateModelSaved; _orderDataController.EditModelSaved += OrderDataControllerOnEditModelSaved; _workItemDataController = new WorkItemDataController(); _workItemDataController.Initialize(); _workItemDataController.CreateModelSaved += WorkItemDataControllerOnCreateModelSaved; _workItemDataController.EditModelSaved += WorkItemDataControllerOnEditModelSaved; _view.editWorkItem.Click += (sender, args) => SelectedWorkItemStartEdit(); _view.createWorkButton.Click += (sender, args) => WorkItemStartCreate(); _deviceItemDataController = new DeviceItemDataController(); _deviceItemDataController.Initialize(); _deviceItemDataController.CreateModelSaved += DeviceItemDataControllerOnCreateModelSaved; _deviceItemDataController.EditModelSaved += DeviceItemDataControllerOnEditModelSaved; _view.editDeviceItem.Click += (sender, args) => SelectedDeviceItemStartEdit(); _view.createDeviceButton.Click += (sender, args) => DeviceItemStartCreate(); _commentDataController = new CommentDataController(); _commentDataController.Initialize(); _commentDataController.CreateModelSaved += CommentDataControllerOnCreateModelSaved; _view.createCommentButton.Click += (sender, args) => CommentStartCreate(); StartUpdateOrderList(1); _customReportPreviewController = new CustomReportPreviewController(); _customReportPreviewController.Initialize(); StartPopulateReportList(); if (ClientCore.Instance.AuthService.SecurityToken.User.ProjectRoleID == ProjectRoleSet.Engineer.ProjectRoleID) { _view.createButton.IsEnabled = false; foreach (var editFormControlModel in _orderDataController.GetEditFormControlModels()) { if (!StringComparer.OrdinalIgnoreCase.Equals(editFormControlModel.Id, "RepairOrderStatusID")) { editFormControlModel.ReadOnly = true; } } } }