public WritingSystemTest()
        {
            InitializeComponent();

            _repository = GlobalWritingSystemRepository.Initialize(MigrationHandler);
            _wsModel = new WritingSystemSetupModel(_repository);
            wsPropertiesPanel1.BindToModel(_wsModel);
        }
        public WritingSystemPickerTestForm()
        {
            InitializeComponent();

            _repository = GlobalWritingSystemRepository.Initialize(null);
            _wsModel = new WritingSystemSetupModel(_repository);
            _wsModel.SelectionChanged += _wsModel_SelectionChanged;
            wsPickerUsingListView1.BindToModel(_wsModel);
            pickerUsingComboBox1.BindToModel(_wsModel);
        }
Exemple #3
0
		public void BindToModel(WritingSystemSetupModel model)
		{
			if (_model != null)
			{
				_model.SelectionChanged -= ModelSelectionChanged;
				_model.CurrentItemUpdated -= ModelCurrentItemUpdated;
			}
			_model = model;
			_model.SelectionChanged += ModelSelectionChanged;
			_model.CurrentItemUpdated += ModelCurrentItemUpdated;
			PopulateFontList();
			UpdateFromModel();
			this.Disposed += OnDisposed;
		}
		public void BindToModel(WritingSystemSetupModel model)
		{
			Debug.Assert(model != null);
			if (_model != null)
			{
				_model.SelectionChanged -= ModelSelectionChanged;
				_model.CurrentItemUpdated -= OnCurrentItemUpdated;
			}
			_model = model;
			SetButtonStatus();
			_model.SelectionChanged += ModelSelectionChanged;
			_model.CurrentItemUpdated += OnCurrentItemUpdated;

			Disposed += OnDisposed;
		}
		public void BindToModel(WritingSystemSetupModel model)
		{
			_model = model;
			_model.MethodToShowUiToBootstrapNewDefinition = ShowCreateNewWritingSystemDialog;

			_buttonBar.BindToModel(_model);
			_propertiesTabControl.BindToModel(_model);

			var treeModel = new WritingSystemTreeModel(_model) {Suggestor = model.WritingSystemSuggestor};
			_treeView.BindToModel(treeModel);
			_model.SelectionChanged += UpdateHeaders;
			_model.CurrentItemUpdated += UpdateHeaders;
			_model.AskUserWhatToDoWithDataInWritingSystemToBeDeleted += OnAskUserWhatToDoWithDataInWritingSystemToBeDeleted;
			UpdateHeaders(null, null);
		}
		public void BindToModel(WritingSystemSetupModel model)
		{
			if (_model != null)
			{
				model.CurrentItemUpdated -= ModelCurrentItemUpdated;
				model.SelectionChanged -= ModelSelectionChanged;
			}
			_model = model;
			if (_model != null)
			{
				UpdateFromModel();
				model.CurrentItemUpdated += ModelCurrentItemUpdated;
				model.SelectionChanged += ModelSelectionChanged;
			}
			this.Disposed += OnDisposed;
		}
		/// <summary>
		/// Call this explicitly if using the constructor which does not set the model
		/// </summary>
		/// <param name="model"></param>
		public void BindToModel(WritingSystemSetupModel model)
		{
			Guard.AgainstNull(model,"model");
			_model = model;
			//in case this is called twice, don't double subscribe
			_model.ItemAddedOrDeleted -= ModelItemAddedOrDeleted;
			_model.ListColumnsChanged -= ModelListColumnsChanged;
			_model.SelectionChanged -= ModelSelectionChanged;
			_model.CurrentItemUpdated -= ModelCurrentItemUpdated;
			this.Disposed -= OnDisposed;

			ReloadItems();
			_model.ItemAddedOrDeleted += ModelItemAddedOrDeleted;
			_model.ListColumnsChanged += ModelListColumnsChanged;
			_model.SelectionChanged += ModelSelectionChanged;
			_model.CurrentItemUpdated += ModelCurrentItemUpdated;
			this.Disposed += OnDisposed;
		}
		public void BindToModel(WritingSystemSetupModel model)
		{
			Debug.Assert(model != null);
			if (_model != null)
			{
				_model.ItemAddedOrDeleted -= ModelItemAddedOrDeleted;
				_model.ListColumnsChanged -= ModelListColumnsChanged;
				_model.SelectionChanged -= ModelSelectionChanged;
				_model.CurrentItemUpdated -= ModelCurrentItemUpdated;
			}
			_model = model;
			RefreshListView();
			_model.ItemAddedOrDeleted += ModelItemAddedOrDeleted;
			_model.ListColumnsChanged += ModelListColumnsChanged;
			_model.SelectionChanged += ModelSelectionChanged;
			_model.CurrentItemUpdated += ModelCurrentItemUpdated;
			this.Disposed += OnDisposed;
		}
		public void BindToModel(WritingSystemSetupModel model)
		{
			 if (_model != null)
			{
				_model.SelectionChanged -= ModelChanged;
				_model.CurrentItemUpdated -= ModelChanged;
			}

			_model = model;
			_identifiersControl.BindToModel(_model);
			_fontControl.BindToModel(_model);
			_keyboardControl.BindToModel(_model);
			_sortControl.BindToModel(_model);
			_spellingControl.BindToModel(_model);


			if (_model != null)
			{
				_model.SelectionChanged+= ModelChanged;
				_model.CurrentItemUpdated += ModelChanged;
			}
			this.Disposed += OnDisposed;
		}
		public WritingSystemSetupView(WritingSystemSetupModel model)
			: this()
		{
			BindToModel(model);
		}
		public WSPickerUsingComboBox(WritingSystemSetupModel model):this()
		{
		   BindToModel(model);
		}
		public void BindToModel(WritingSystemSetupModel model)
		{
			if (_model != null)
			{
				_model.SelectionChanged -= ModelSelectionChanged;
				_model.CurrentItemUpdated -= ModelCurrentItemUpdated;
			}
			_model = model;
			Enabled = false;
			if (_model != null)
			{
				_model.SelectionChanged += ModelSelectionChanged;
				_model.CurrentItemUpdated += ModelCurrentItemUpdated;
				PopulateKeyboardList();
				UpdateFromModel();
			}
			Disposed += OnDisposed;
		}
		public WritingSystemSetupDialog(IWritingSystemRepository repository)
		{
			InitializeComponent();
			_model = new WritingSystemSetupModel(repository);
			_writingSystemSetupView.BindToModel(_model);
		}
   /* turned out to be hard... so many events are bound to the model, when the dlg
	* closes we'd need to carefully unsubscribe them alll.
	* Better to try again with a weak event model (JH)
	* Or perhaps better yet the passive view model
	*/
		/// <summary>
		/// Use this one to keep, say, a picker up to date with any change you make
		/// while using the dialog.
		/// </summary>
		/// <param name="writingSystemModel"></param>
		public WritingSystemSetupDialog(WritingSystemSetupModel writingSystemModel)
		{
			InitializeComponent();
			_model = writingSystemModel;
			_writingSystemSetupView.BindToModel(_model);
		}