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); }
public IpaIdentifierView(WritingSystemSetupModel model) { _model = model; InitializeComponent(); if (model != null) { model.SelectionChanged += UpdateDisplayFromModel; } }
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) { 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 WritingSystemSetupViewWithComboAttached() { var runner = new CrossThreadTestRunner(); runner.RunInSTA( delegate { using (var folder = new TemporaryFolder("WS-Test")) { var f = new Form(); f.Size = new Size(800, 600); var repository = LdmlInFolderWritingSystemRepository.Initialize(folder.Path, DummyWritingSystemHandler.onMigration, DummyWritingSystemHandler.onLoadProblem); var model = new WritingSystemSetupModel(repository); var v = new WritingSystemSetupView(model); var combo = new WSPickerUsingComboBox(model); f.Controls.Add(combo); f.Controls.Add(v); f.ShowDialog(); } }); }
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 void ImportFile_SingleWSMode_Throws() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.Throws<InvalidOperationException>( () => _model.ImportFile("foo.xml") ); }
public void SingleWSMode_UsingStore_IsFalse() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.IsFalse(_model.UsingWritingSystemRepository); }
public void SingleWSMode_WSIsSelected() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.IsTrue(_model.HasCurrentSelection); }
public void SingleWSMode_HasOnlyOne() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.AreEqual(1, _model.WritingSystemCount); }
public void SingleWSMode_Save_Throws() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.Throws<InvalidOperationException>( () => _model.Save() ); }
public void SingleWSMode_DuplicateCurrent_Throws() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.Throws<InvalidOperationException>( () => _model.DuplicateCurrent() ); }
public void SetAllPossibleAndRemoveOthers_NewDuplicateWs_SetsToRepo() { Assert.That(_writingSystemRepository.Count, Is.EqualTo(0)); //reinitialize the model with a prepopulated repo _writingSystemRepository.Set(new WritingSystemDefinition("en")); _model = new WritingSystemSetupModel(_writingSystemRepository); //add a new writing system definition with identical Id _model.AddPredefinedDefinition(new WritingSystemDefinition("en")); _model.SetAllPossibleAndRemoveOthers(); Assert.That(_writingSystemRepository.Count, Is.EqualTo(2)); Assert.That(_writingSystemRepository.Contains("en")); Assert.That(_writingSystemRepository.Contains("en-x-dupl0")); }
private void SetupDialogFromCurrentWritingSystem() { IWritingSystem ws = CurrentWritingSystem; UpdateListBoxButtons(); // Setup General Tab information Set_tbLanguageName(ws.LanguageSubtag.Name ?? string.Empty); SetupEthnologueCode(ws); m_defaultFontsControl.WritingSystem = ws; //Switch Encoding Converters to the one for the user selected writing system Select_cbEncodingConverter(); PopulateSpellingDictionaryComboBox(); // Update all the labels using the selected language display name SetLanguageNameLabels(); Set_regionVariantControl(ws); SetFullNameLabels(ws.DisplayLabel); if(tabControl.SelectedTab == tpSorting) { SetupSortTab(ws); } m_modelForKeyboard = new WritingSystemSetupModel((WritingSystemDefinition) ws); m_keyboardControl.BindToModel(m_modelForKeyboard); }
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); }
public void SetAllPossibleAndRemoveOthers_DuplicateIsCreatedFromWsAlreadyInRepoAndWouldBeRenamedToSelf_SetsToRepo() { Assert.That(_writingSystemRepository.Count, Is.EqualTo(0)); var ws = new WritingSystemDefinition("en-x-dupl0"); //reinitialize the model with a prepopulated repo _writingSystemRepository.Set(new WritingSystemDefinition("en")); _writingSystemRepository.Set(ws); _model = new WritingSystemSetupModel(_writingSystemRepository); //Now change the Id so it's a duplicate of another ws already in the repo ws.Variant = ""; _model.SetAllPossibleAndRemoveOthers(); Assert.That(_writingSystemRepository.Count, Is.EqualTo(2)); Assert.That(_writingSystemRepository.Contains("en")); Assert.That(_writingSystemRepository.Contains("en-x-dupl0")); }
public WSPickerUsingComboBox(WritingSystemSetupModel model):this() { BindToModel(model); }
public void Setup() { ErrorReport.IsOkToInteractWithUser = false; ShowOncePerSessionBasedOnExactMessagePolicy.Reset(); _testFilePath = Path.GetTempFileName(); _writingSystemRepository = new LdmlInXmlWritingSystemRepository(); _model = new WritingSystemSetupModel(_writingSystemRepository); }
public void SingleWSMode_ChangingCurrentIndex_Throws() { _model = new WritingSystemSetupModel(new WritingSystemDefinition()); Assert.Throws<InvalidOperationException>( () => _model.CurrentIndex = -1 ); }