public WritingSystemTreeModel CreateModel()
			{
				var model = new WritingSystemTreeModel(MockSetupModel.Object);
				model.Suggestor = new WritingSystemSuggestor(_testWritingSystemFactory)
				{
					SuggestIpa = false,
					SuggestOther = false,
					SuggestDialects = false,
					SuggestVoice = false,
					OtherKnownWritingSystems = null
				};
				return model;
			}
		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);
		}
		private static void AssertTreeNodeLabels(WritingSystemTreeModel model, params string[] names)
		{
			var items = model.GetTreeItems().ToArray();
			int childIndex = 0;
			for (int i = 0, x=-1; i < names.Count(); i++)
			{
				string itemText;
				if (!string.IsNullOrEmpty(names[i]) && names[i].Substring(0, 1) == "+")
				{
					var child = items[x].Children[childIndex];
					itemText = "+"+child.Text;
					++childIndex;
				}
				else
				{
					//if we aren't looking at a child node, move to the next top level node
					++x;
					itemText = items[x].Text;
					childIndex = 0;
				}
				if (names[i] != itemText)
				{
					PrintExpectationsVsActual(names, items);
				}
				Assert.AreEqual(names[i], itemText);
				int total=0;
				foreach (var item in items)
				{
					++total;
					total+=item.Children.Count();
				}
				if(names.Count()!=total)
					PrintExpectationsVsActual(names, items);
				Assert.AreEqual(names.Count(), total,"the actual nodes exceded the number of expected ones");
			}
		}
Esempio n. 4
0
 public WritingSystemTreeView(WritingSystemTreeModel model)
 {
     InitializeComponent();
     BindToModel(model);
 }
Esempio n. 5
0
 public void BindToModel(WritingSystemTreeModel model)
 {
     _model = model;
     _model.UpdateDisplay += OnUpdateDisplay;
 }
		public WritingSystemTreeView(WritingSystemTreeModel model)
		{
		   InitializeComponent();
		   BindToModel(model);
		}
		public void BindToModel(WritingSystemTreeModel model)
		{
			  _model = model;
			_model.UpdateDisplay += OnUpdateDisplay;
		}