Exemplo n.º 1
0
		private void GenerateResources_Click(object sender, RoutedEventArgs e)
		{
			_allResources.Clear();

			foreach (var group in _chosenLiterals.GroupBy(l => l.StringValue))
			{
				var first = group.First();

				var newRes = new StringResource(true, group)
				{
					ConstantName = GenerateNewResourceName(first),
					EngString = first.StringValue,
					RusString = first.StringValue,
					IsModified = true
				};
				_allResources.Add(newRes);
			}


			ApplyResourcesFilterSelect();
		}
Exemplo n.º 2
0
		private bool ApplyResourcesFilterSelect(StringResource trySelect = null)
		{
			var selectedItem = _dataGridResources.SelectedItem as StringResource;

			ApplyResourcesFilter();

			if (trySelect != null)
			{
				if (FilteredResources.Contains(trySelect))
				{
					_dataGridResources.SelectedItem = trySelect;
					_dataGridResources.ScrollIntoView(trySelect);

					return true;
				}

				return false;
			} 

			if (selectedItem != null && FilteredResources.Contains(selectedItem))
			{
				_dataGridResources.SelectedItem = selectedItem;
				_dataGridResources.ScrollIntoView(selectedItem);

				return true;
			}

			return false;
		}
Exemplo n.º 3
0
		private void AddNewResource_Click(object sender, RoutedEventArgs e)
		{
			var literal = _listChosenLiterals.SelectedItem as SourceCodeLiteral;

			var newRes = new StringResource(true) { ConstantName = GenerateNewResourceName(literal), IsModified = false };
			_allResources.Add(newRes);

			var selected = ApplyResourcesFilterSelect(newRes);

			if (selected)
			{
				_dataGridResources.CurrentCell = new DataGridCellInfo(newRes, _dataGridResources.Columns[0]);
				_dataGridResources.Focus();
				_dataGridResources.BeginEdit();
			}
		}