Ejemplo n.º 1
0
        private void BrdFormat_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var RowItem = Display.GetNearestVisualDominantOfType <ListBoxItem>((DependencyObject)sender);
            var RegEdit = RowItem.Content as TextFormatEditRegister;

            var Result = TextFormatSelector.SelectFor(RegEdit.RegFormat);

            if (Result.Item1)
            {
                RegEdit.RegFormat = Result.Item2;

                var Sampler = Display.GetTemplateChild <TextFormatSampler>(RowItem, "FormatSampler");
                Sampler.Format = Result.Item2;  // Don't know why the databinding didn't work
                Sampler.Refresh();

                // Apply
                var OriginalFormat = this.TargetSymbolFormat.GetTextFormat(RegEdit.RegPurpose);
                var Differences    = General.DetermineDifferences(RegEdit.RegFormat, OriginalFormat);

                if (Differences != null)
                {
                    this.TargetSymbolFormat.SetTextFormat(RegEdit.RegPurpose, RegEdit.RegFormat);
                }
            }
        }
        private void TextFormatSampler_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var Source = sender as TextFormatSampler;

            if (Source == null || CompositionEngine.ActiveEntityEditor == null)
            {
                return;
            }

            var Result = TextFormatSelector.SelectFor(Source.Format);

            if (Result == null || !Result.Item1)
            {
                return;
            }

            CompositionEngine.ActiveEntityEditor.StartCommandVariation("Change Text Format");

            Source.Format = Result.Item2;

            CompositionEngine.ActiveEntityEditor.CompleteCommandVariation();
        }