Esempio n. 1
0
        public WidgetViewModelProxy(IWidgetPlugin plugin, IWidgetTemplate widgetTemplate, IDataSourceAnalyser analyser)
        {
            _plugin         = plugin;
            _widgetTemplate = widgetTemplate;
            _analyser       = analyser;
            _deleteCommand  = new DelegateCommand(Delete);

            try
            {
                InnerViewModel = plugin.CreateViewModel(widgetTemplate, analyser);
            }
            catch (Exception e)
            {
                var type = plugin.GetType();
                Log.ErrorFormat("{0}.CreateViewModel() threw exception:\r\n{1}", type.FullName, e);
            }

            if (InnerViewModel != null)
            {
                InnerViewModel.PropertyChanged  += ViewModelOnPropertyChanged;
                InnerViewModel.TemplateModified += ViewModelOnTemplateModified;

                try
                {
                    Content = plugin.CreateContentPresenterFor(InnerViewModel);
                }
                catch (Exception e)
                {
                    var type = plugin.GetType();
                    Log.ErrorFormat("{0}.CreateContentPresenterFor() threw exception:\r\n{1}", type.FullName, e);
                }
            }
        }
 public EntryCountWidgetViewModel(IWidgetTemplate template, IDataSourceAnalyser dataSourceAnalyser)
     : base(template, dataSourceAnalyser)
 {
     _configuration = AnalyserConfiguration as LogEntryCountAnalyserConfiguration;
     Title          = "Line Count";
     Caption        = "Line(s)";
     _quickFilters  = new FiltersViewModel(_configuration?.QuickFilters);
 }
Esempio n. 3
0
        public DataSourcesWidgetViewModel(IWidgetTemplate template, IDataSourceAnalyser dataSourceAnalyser)
            : base(template, dataSourceAnalyser)
        {
            _dataSources     = new ObservableCollection <DataSourceViewModel>();
            _dataSourcesById = new Dictionary <DataSourceId, DataSourceViewModel>();
            CanBeEdited      = true;

            Configuration.PropertyChanged += ConfigurationOnPropertyChanged;
        }
        public QuickInfoWidgetViewModel(IWidgetTemplate template,
                                        IDataSourceAnalyser dataSourceAnalyser)
            : base(template, dataSourceAnalyser)
        {
            _viewConfiguration     = template.Configuration as QuickInfoWidgetConfiguration;
            _analyserConfiguration = AnalyserConfiguration as QuickInfoAnalyserConfiguration;

            _quickInfosById      = new Dictionary <Guid, QuickInfoViewModel>();
            _quickInfos          = new ObservableCollection <QuickInfoViewModel>();
            _addQuickInfoCommand = new DelegateCommand2(AddQuickInfo);

            PropertyChanged += OnPropertyChanged;
        }
        /// <summary>
        /// </summary>
        protected AbstractWidgetViewModel(IWidgetTemplate template,
                                          IDataSourceAnalyser dataSourceAnalyser)
        {
            if (dataSourceAnalyser == null)
            {
                throw new ArgumentNullException(nameof(dataSourceAnalyser));
            }

            _dataSourceAnalyser   = dataSourceAnalyser;
            AnalyserConfiguration = CloneConfiguration(dataSourceAnalyser);
            Template    = template;
            CanBeEdited = AnalyserConfiguration != null && !dataSourceAnalyser.IsFrozen;
        }
Esempio n. 6
0
        /// <summary>
        /// </summary>
        protected AbstractWidgetViewModel(IWidgetTemplate template,
                                          IDataSourceAnalyser dataSourceAnalyser)
        {
            if (dataSourceAnalyser == null)
            {
                throw new ArgumentNullException(nameof(dataSourceAnalyser));
            }

            _dataSourceAnalyser    = dataSourceAnalyser;
            _analyserConfiguration = dataSourceAnalyser.Configuration?.Clone() as ILogAnalyserConfiguration;
            _isAnalysisFinished    = false;
            _template     = template;
            CanBeEdited   = AnalyserConfiguration != null && !dataSourceAnalyser.IsFrozen;
            DeleteCommand = new DelegateCommand(Delete);
        }
        public QuickInfoWidgetViewModel(IWidgetTemplate template,
                                        IDataSourceAnalyser dataSourceAnalyser)
            : base(template, dataSourceAnalyser)
        {
            _viewConfiguration     = template.Configuration as QuickInfoWidgetConfiguration ?? new QuickInfoWidgetConfiguration();
            _analyserConfiguration = AnalyserConfiguration as QuickInfoAnalyserConfiguration ?? new QuickInfoAnalyserConfiguration();

            _quickInfosById      = new Dictionary <Guid, QuickInfoViewModel>();
            _quickInfos          = new ObservableCollection <QuickInfoViewModel>();
            _addQuickInfoCommand = new DelegateCommand2(AddQuickInfo);

            foreach (var quickInfo in _viewConfiguration.Titles)
            {
                var analysis = _analyserConfiguration.QuickInfos.FirstOrDefault(x => x.Id == quickInfo.Id);
                if (analysis != null)
                {
                    AddQuickInfo(quickInfo.Id, quickInfo, analysis);
                }
            }

            PropertyChanged += OnPropertyChanged;
        }
Esempio n. 8
0
 public IWidgetViewModel CreateViewModel(IWidgetTemplate template, IDataSourceAnalyser dataSourceAnalyser)
 {
     return(new DataSourcesWidgetViewModel(template, dataSourceAnalyser));
 }
Esempio n. 9
0
 public HelpWidgetViewModel(IWidgetTemplate template, IDataSourceAnalyser dataSourceAnalyser)
     : base(template, dataSourceAnalyser)
 {
     Title = "Help";
 }
Esempio n. 10
0
 /// <summary>
 ///     Removes the given widget from this template.
 /// </summary>
 /// <param name="template"></param>
 public void Remove(IWidgetTemplate template)
 {
     _widgets.Remove(template);
 }
Esempio n. 11
0
 /// <summary>
 ///     Adds the given widget to this template.
 /// </summary>
 /// <param name="template"></param>
 public void Add(IWidgetTemplate template)
 {
     _widgets.Add(template);
 }