Example #1
0
        private static bool ShowEditPresetDialog(Window owner, Stream stream, LexPreset preset,
                                                 IEnumerable <string> names)
        {
            var view = new LexPresetView {
                Owner = owner
            };
            var viewModel = view.ViewModel;

            viewModel.Names            = names.ToArray();
            viewModel.LogStream        = stream;
            viewModel.Name             = preset.Name;
            viewModel.CommonCode.Text  = preset.CommonCode ?? string.Empty;
            viewModel.SegmentCode.Text = preset.SegmentCode ?? string.Empty;
            viewModel.RecordCode.Text  = preset.RecordCode ?? string.Empty;
            viewModel.IsChanged        = false;

            if (view.ShowDialog() != true)
            {
                return(false);
            }

            preset.Name        = viewModel.Name;
            preset.CommonCode  = viewModel.CommonCode.Text;
            preset.SegmentCode = viewModel.SegmentCode.Text;
            preset.RecordCode  = viewModel.RecordCode.Text;
            preset.Format      = viewModel.IsCompiled ? viewModel.Format : null;

            return(true);
        }
Example #2
0
        private static ILogFormat CompileManually(Window owner, Stream stream, LexPreset preset)
        {
            var view = new LexPresetView {
                Owner = owner
            };
            var viewModel = view.ViewModel;

            viewModel.LogStream        = stream;
            viewModel.Name             = preset.Name;
            viewModel.CommonCode.Text  = preset.CommonCode ?? string.Empty;
            viewModel.SegmentCode.Text = preset.SegmentCode ?? string.Empty;
            viewModel.RecordCode.Text  = preset.RecordCode ?? string.Empty;
            viewModel.IsChanged        = false;

            if (view.ShowDialog() != true)
            {
                return(null);
            }

            return(viewModel.Format);
        }
        private static bool ShowEditPresetDialog(Window owner, Stream stream, LexPreset preset,
            IEnumerable<string> names)
        {
            var view = new LexPresetView {Owner = owner};
            var viewModel = view.ViewModel;

            viewModel.Names = names.ToArray();
            viewModel.LogStream = stream;
            viewModel.Name = preset.Name;
            viewModel.CommonCode.Text = preset.CommonCode ?? string.Empty;
            viewModel.SegmentCode.Text = preset.SegmentCode ?? string.Empty;
            viewModel.RecordCode.Text = preset.RecordCode ?? string.Empty;
            viewModel.IsChanged = false;

            if (view.ShowDialog() != true)
                return false;

            preset.Name = viewModel.Name;
            preset.CommonCode = viewModel.CommonCode.Text;
            preset.SegmentCode = viewModel.SegmentCode.Text;
            preset.RecordCode = viewModel.RecordCode.Text;
            preset.Format = viewModel.IsCompiled ? viewModel.Format : null;

            return true;
        }
        private static ILogFormat CompileManually(Window owner, Stream stream, LexPreset preset)
        {
            var view = new LexPresetView {Owner = owner};
            var viewModel = view.ViewModel;

            viewModel.LogStream = stream;
            viewModel.Name = preset.Name;
            viewModel.CommonCode.Text = preset.CommonCode ?? string.Empty;
            viewModel.SegmentCode.Text = preset.SegmentCode ?? string.Empty;
            viewModel.RecordCode.Text = preset.RecordCode ?? string.Empty;
            viewModel.IsChanged = false;

            if (view.ShowDialog() != true)
                return null;

            return viewModel.Format;
        }