public TerminationCommand() { Text = CultureService.Instance.GetString(CultureText.menuItem_Termination_Text); ToolTipText = CultureService.Instance.GetString(CultureText.menuItem_Termination_ToolTip); Image = Resources.Resistor16; CheckOnClick = true; Checked = false; DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; EventAggregator.Instance.Subscribe <StorageAppEvent>(e => { if (e.ChangingType == FileChangingType.LoadComplete) { _parmeters = e.Storage.Parameters; Checked = e.Storage.Parameters.Termination; } }); EventAggregator.Instance.Subscribe <StorageAppEvent>(e => { if (e.ChangingType == FileChangingType.ContentChanged) { if (e.Details.DataObjects == DataObjects.ParameterProperty && e.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e.Storage.Parameters.Termination)) { Checked = e.Storage.Parameters.Termination; } } }); EventAggregator.Instance.Subscribe <StopAppEvent>(e => Enabled = true); EventAggregator.Instance.Subscribe <PlayAppEvent>(e => Enabled = false); }
void Default_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == PropertyPlus.GetPropertyName(() => Settings.Default.IsDeveloperMode)) { splitContainerMainView.Panel2Collapsed = !Settings.Default.IsDeveloperMode; } }
public MsgUpdateTreeNode(MessageStatisticsItem message, ProjectParameters parameters) { _message = message; _parameters = parameters; Name = "updatedTreeViewItem1"; Text = string.Empty; SelectedImageKey = ImageKey = @"watch16"; TimerService.Instance.Tick += new EventHandler(Timer_Tick); EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.TimestampFormat)) { Text = CultureService.Instance.GetString(CultureText.node_Time_Text) + @": "; if (_message.Timestamp != null) { Text += _message.Timestamp.Value.ToString(e1.Storage.Parameters.TimestampFormat, System.Globalization.CultureInfo.InvariantCulture); } else { Text += AppConstants.ValueNotAvailable2; } } }); message.DefaultStateComplete += (o, e) => Timer_Tick(null, EventArgs.Empty); }
public MsgDataTreeNode(MessageStatisticsItem message) { _message = message; Name = "dataTreeViewItem1"; Text = CultureService.Instance.GetString(CultureText.node_Data_Text) + @": " + new DataFrameConverter().ConvertTo(message.Data, typeof(string)); SelectedImageKey = ImageKey = @"data16"; EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.DataFormat)) { if (message.Data != null) { Text = CultureService.Instance.GetString(CultureText.node_Data_Text) + @": " + new DataFrameConverter().ConvertTo(message.Data, typeof(string)); } else { Text = AppConstants.ValueNotAvailable2; } } }); TimerService.Instance.Tick += new EventHandler(Timer_Tick); message.DefaultStateComplete += (o, e) => Timer_Tick(null, EventArgs.Empty); }
/// <summary> /// TreeView Top eleme /// </summary> /// <param name="logs"></param> /// <param name="description"></param> /// <param name="view"></param> public LogTopTreeNode(IApp appx, ILogFileCollection logs, ILogDescriptionView description) { Text = CultureService.Instance.GetString(CultureText.node_Logs_Text); SelectedImageKey = ImageKey = "log16"; _description = description; Logs = logs; Storage storage = null; EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { storage = e1.Storage; switch (e1.ChangingType) { case FileChangingType.LoadComplete: { /*Itt kezdi listázni a log fájlokat project betötlését követően.*/ Logs.Load(storage.Loaction, storage.FileName); if (e1.Storage.Parameters.LogEnabled) { Text = CultureService.Instance.GetString(CultureText.node_Logs_Text); } else { Text = CultureService.Instance.GetString(CultureText.node_Logs_Text); Text += string.Format(" [{0}] ", CultureService.Instance.GetString(CultureText.text_DISABLED)); } break; } case FileChangingType.ContentChanged: { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.LogEnabled)) { if (e1.Storage.Parameters.LogEnabled) { Text = CultureService.Instance.GetString(CultureText.node_Logs_Text); } else { Text = CultureService.Instance.GetString(CultureText.node_Logs_Text); Text += string.Format(" [{0}] ", CultureService.Instance.GetString(CultureText.text_DISABLED)); } } break; }; } }); logs.ListChanged += new ListChangedEventHandler(LogFiles_ListChanged); logs.ListChanging += new ListChangingEventHandler <ILogFileItem>(LogFiles_ListChanging); }
/// <summary> /// Mezők validálása /// </summary> /// <param name="columnName"></param> /// <returns></returns> private string OnValidate(string columnName) { #region Name if (columnName == PropertyPlus.GetPropertyName(() => Name)) { object obj = typeof(CanTxMessageItem).GetProperty(PropertyPlus.GetPropertyName(() => Name)).GetValue(this, null); if (!string.IsNullOrWhiteSpace(obj as string)) { /*Ez itt kell*/ _lastError = ConsistencyCheck.Symbol(obj as string); return(_lastError); } else { return(null); } } #endregion #region Data if (columnName == PropertyPlus.GetPropertyName(() => Data)) { object obj = typeof(CanTxMessageItem).GetProperty(PropertyPlus.GetPropertyName(() => Data)).GetValue(this, null); if (string.IsNullOrWhiteSpace(obj as string)) { /*Ennek itt nincs értelme*/ //try { new DataFrameConverter().ConvertFrom(obj as string); } //catch (Exception ex) { LastError = ex.Message; return LastError; } } return(null); } else if (columnName == PropertyPlus.GetPropertyName(() => Length)) { object obj = typeof(CanTxMessageItem).GetProperty(PropertyPlus.GetPropertyName(() => Length)).GetValue(this, null); if ((int)obj > 8) { _lastError = CultureService.Instance.GetString(CultureText.text_DataTooLong); return(_lastError); } } else if (columnName == PropertyPlus.GetPropertyName(() => ArbitrationId)) { } _lastError = null; return(null); #endregion }
public FilterNameTreeNode(MessageFilterItem item) { Tag = item; _item = item; if (_item.AcceptanceCount.HasValue) { Text = _item.Name + @": " + _item.AcceptanceCount; } else { Text = _item.Name + @": " + AppConstants.ValueNotAvailable2; } if (item.Enabled) { SelectedImageKey = ImageKey = @"FilterFilled16"; } else { SelectedImageKey = ImageKey = @"FilterClear16"; } item.PropertyChanged += (o, e) => { if (e.PropertyName == PropertyPlus.GetPropertyName(() => item.Enabled)) { if (item.Enabled) { SelectedImageKey = ImageKey = @"FilterFilled16"; } else { SelectedImageKey = ImageKey = @"FilterClear16"; } } else if (e.PropertyName == PropertyPlus.GetPropertyName(() => item.Name)) { if (_item.AcceptanceCount.HasValue) { Text = item.Name + @": " + item.AcceptanceCount; } else { Text = item.Name + @": " + AppConstants.ValueNotAvailable2; } } }; TimerService.Instance.Tick += new EventHandler(Timer_Tick); item.DefaultStateComplete += (o, e) => Timer_Tick(null, EventArgs.Empty); }
public MessagesTreeNode(MessageStatistics statistics, IAdapterService adapter, ProjectParameters parameters) { _statistics = statistics; _adapter = adapter; _parameters = parameters; Text = CultureService.Instance.GetString(CultureText.node_MessagesStatistics_Text); SelectedImageKey = ImageKey = @"mails16"; EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { switch (e1.ChangingType) { case FileChangingType.LoadComplete: { if (e1.Storage.Parameters.MessageStatisticsEnabled) { Text = CultureService.Instance.GetString(CultureText.node_MessagesStatistics_Text); } else { Text = CultureService.Instance.GetString(CultureText.node_MessagesStatistics_Text); Text += string.Format(" [{0}] ", CultureService.Instance.GetString(CultureText.text_DISABLED)); } break; } case FileChangingType.ContentChanged: { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.MessageStatisticsEnabled)) { if (e1.Storage.Parameters.MessageStatisticsEnabled) { Text = CultureService.Instance.GetString(CultureText.node_MessagesStatistics_Text); } else { Text = CultureService.Instance.GetString(CultureText.node_MessagesStatistics_Text); Text += string.Format(" [{0}] ", CultureService.Instance.GetString(CultureText.text_DISABLED)); } } break; }; } }); _statistics.Messages.ListChanged += new ListChangedEventHandler(Messages_ListChanged); }
/// <summary> /// Settings tulajodnság változtt. /// </summary> void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e) { Debug.WriteLine(GetType().Namespace + "." + GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "(): " + e.PropertyName + ", NewValue: " + Settings.Default[e.PropertyName]); if (e.PropertyName == PropertyPlus.GetPropertyName(() => Settings.Default.ShowWorkingDirectoryInTitleBar)) { /*Project fájl neve...*/ _mainForm.Text = _storage.ToString(); } if (e.PropertyName == PropertyPlus.GetPropertyName(() => Settings.Default.GuiRefreshRateMs)) { TimerService.Instance.Interval = Settings.Default.GuiRefreshRateMs; } }
public MsgArbitrationIdTreeNode(MessageStatisticsItem message) { SelectedImageKey = ImageKey = @"id16"; /*Arbitration Id: [{0}]*/ Text = string.Format(CultureService.Instance.GetString(CultureText.node_ArbitrationId_Text), new ArbitrationIdConverter().ConvertTo(message.ArbitrationId, typeof(string))); EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.ArbitrationIdFormat)) { Text = string.Format(CultureService.Instance.GetString(CultureText.node_ArbitrationId_Text), new ArbitrationIdConverter().ConvertTo(message.ArbitrationId, typeof(string))); } }); }
/// <summary> /// Konstruktor /// </summary> public NavigatorTreeView() { InitializeComponent(); if (Nodes.Count != 0) { Nodes.Clear(); } _generalNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => GeneralNode) }; _projectNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => ProjectNode) }; _projectRepresentationNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => ProjectRepresentationNode) }; _projectNode.Nodes.Add(_projectRepresentationNode); _projectFunctionsNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => ProjectFunctionsNode) }; _projectNode.Nodes.Add(_projectFunctionsNode); _projectCustomArbIdColumnsNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => ProjectCustomArbIdColumnsNode) }; _projectNode.Nodes.Add(_projectCustomArbIdColumnsNode); _developerNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => DeveloperNode) }; _aboutNode = new TreeNode { Name = PropertyPlus.GetPropertyName(() => AboutNode) }; Nodes.AddRange(new TreeNode[] { _generalNode, _projectNode, _developerNode, _aboutNode }); SelectedNode = _generalNode; }
/// <summary> /// /// </summary> public AdapterComboBox() { DropDownStyle = ComboBoxStyle.DropDownList; AutoToolTip = true; Items.AddRange(AdapterService.GetAdapters()); Size = new System.Drawing.Size(200, 25); EventAggregator.Instance.Subscribe <StorageAppEvent>(e => { if (e.Details.DataObjects == DataObjects.ParameterProperty && e.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e.Storage.Parameters.DeviceName)) { _parmeters = e.Storage.Parameters; SelectedItem = e.Storage.Parameters.DeviceName; } }); EventAggregator.Instance.Subscribe <StopAppEvent>(e => Enabled = true); EventAggregator.Instance.Subscribe <PlayAppEvent>(e => Enabled = false); }
public void SetBinding() { paramControl1.DataBindings.Add("ParamValue", vrd, PropertyPlus.GetPropertyName(() => vrd.Param_a)); paramControl1.ParamName = PropertyPlus.GetPropertyDescription(vrd, PropertyPlus.GetPropertyName(() => vrd.Param_a)); paramControl2.DataBindings.Add("ParamValue", vrd, PropertyPlus.GetPropertyName(() => vrd.Param_b)); paramControl2.ParamName = PropertyPlus.GetPropertyDescription(vrd, PropertyPlus.GetPropertyName(() => vrd.Param_b)); paramControl3.DataBindings.Add("ParamValue", vrd, PropertyPlus.GetPropertyName(() => vrd.Param_c)); paramControl3.ParamName = PropertyPlus.GetPropertyDescription(vrd, PropertyPlus.GetPropertyName(() => vrd.Param_c)); paramControl4.DataBindings.Add("ParamValue", vrd, PropertyPlus.GetPropertyName(() => vrd.Param_d)); paramControl4.ParamName = PropertyPlus.GetPropertyDescription(vrd, PropertyPlus.GetPropertyName(() => vrd.Param_d)); paramControl5.DataBindings.Add("ParamValue", vrd, PropertyPlus.GetPropertyName(() => vrd.Param_Rr)); paramControl5.ParamName = PropertyPlus.GetPropertyDescription(vrd, PropertyPlus.GetPropertyName(() => vrd.Param_Rr)); paramControl6.DataBindings.Add("ParamValue", vrd, PropertyPlus.GetPropertyName(() => vrd.Param_f)); paramControl6.ParamName = PropertyPlus.GetPropertyDescription(vrd, PropertyPlus.GetPropertyName(() => vrd.Param_f)); }
/// <summary> /// Project változott és ez rléteszenzé a változásokat, ami alapján a céltudosabban lehetne viselkedni. /// </summary> private void ProjectService_ContentChanged(object sender, StorageChanegdEventArgs e) { Debug.WriteLine(GetType().Namespace + "." + GetType().Name + "." + MethodBase.GetCurrentMethod().Name + "():" + e.ToString()); if (e.DataObjects == DataObjects.ParameterProperty) { /*A megjelítéshez tartozó konverterek itt frissülnek*/ if (e.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => _storage.Parameters.ArbitrationIdFormat)) { Converters.ArbitrationIdConverter.Format = _storage.Parameters.ArbitrationIdFormat; } if (e.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => _storage.Parameters.DataFormat)) { Converters.DataFrameConverter.Format = _storage.Parameters.DataFormat; } } /*Project fájl neve...*/ MainForm.Text = _storage.ToString(); EventAggregator.Instance.Publish(new StorageAppEvent(_storage, FileChangingType.ContentChanged, e)); }
public MsgNameTreeNode(MessageStatisticsItem message, TreeNode[] subNodes) { Message = message; Name = "nameTreeViewItem1"; Nodes.AddRange(subNodes); SelectedImageKey = ImageKey = @"Mail_16x16"; var arbid = new ArbitrationIdConverter().ConvertTo(message.ArbitrationId, typeof(string)) as string; if (string.IsNullOrEmpty(message.Name)) { /*Message: No Name [{0}]*/ Text = string.Format(CultureService.Instance.GetString(CultureText.node_MessageNoNameArbId_Text), arbid); } else { /*Message: {0} [{1}]*/ Text = string.Format(CultureService.Instance.GetString(CultureText.node_MessageNameArbId_Text), message.Name, arbid); } EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.ArbitrationIdFormat)) { arbid = new ArbitrationIdConverter().ConvertTo(message.ArbitrationId, typeof(string)) as string; if (string.IsNullOrEmpty(message.Name)) { /*Message: No Name [{0}]*/ Text = string.Format(CultureService.Instance.GetString(CultureText.node_MessageNoNameArbId_Text), arbid); } else { /*Message: {0} [{1}]*/ Text = string.Format(CultureService.Instance.GetString(CultureText.node_MessageNameArbId_Text), message.Name, arbid); } } }); }
public ProjectTopTreeNode(TreeNode[] subNodes) { Nodes.AddRange(subNodes); Text = @"CP1540"; SelectedImageKey = ImageKey = @"Statistics16"; EventAggregator.Instance.Subscribe <StorageAppEvent>(e => { if (e.ChangingType == FileChangingType.LoadComplete) { Text = e.Storage.FileName; } }); EventAggregator.Instance.Subscribe <StorageAppEvent>(e => { if (e.Details.DataObjects == DataObjects.ParameterProperty && e.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e.Storage.Parameters.Comment)) { ToolTipText = e.Storage.Parameters.Comment; } }); }
public AdapterStatisticsTreeNode(IAdapterStatistics statistics) { Text = CultureService.Instance.GetString(CultureText.node_AdapterStatistics_Text); SelectedImageKey = ImageKey = @"Statistics16"; Nodes.AddRange(new TreeNode[] { new TransmittedTreeNode( new TreeNode[] { new TotalTreeNode(statistics.Transmitted), new DropTreeNode(statistics.Transmitted), new PendingTreeNode(statistics.Transmitted), new ErrorTreeNode(statistics.Transmitted) }), new ReceivedTreeNode( new TreeNode[] { new TotalTreeNode(statistics.Received), new DropTreeNode(statistics.Received), new PendingTreeNode(statistics.Received), new ErrorTreeNode(statistics.Received) }) }); EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { switch (e1.ChangingType) { case FileChangingType.LoadComplete: { if (e1.Storage.Parameters.AdapterStatisticsEnabled) { Text = CultureService.Instance.GetString(CultureText.node_AdapterStatistics_Text); } else { Text = CultureService.Instance.GetString(CultureText.node_AdapterStatistics_Text); Text += string.Format(" [{0}] ", CultureService.Instance.GetString(CultureText.text_DISABLED)); } break; } case FileChangingType.ContentChanged: { if (e1.Details.DataObjects == DataObjects.ParameterProperty && e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.AdapterStatisticsEnabled)) { if (e1.Storage.Parameters.AdapterStatisticsEnabled) { Text = CultureService.Instance.GetString(CultureText.node_AdapterStatistics_Text); } else { Text = CultureService.Instance.GetString(CultureText.node_AdapterStatistics_Text); Text += string.Format(" [{0}] ", CultureService.Instance.GetString(CultureText.text_DISABLED)); } } break; } } }); }
private string OnValidate(string columnName) { #region Name if (columnName == PropertyPlus.GetPropertyName(() => Name)) { const int ruleMaxNameLength = 32; var value = typeof(CustomArbIdColumnItem).GetProperty(PropertyPlus.GetPropertyName(() => Name)).GetValue(this, null); if (string.IsNullOrWhiteSpace(value as string) || string.IsNullOrEmpty(value as string)) { _lastError = CultureText.text_TheFieldCantBeEmtpy; return(_lastError); } if ((value as string).Length > ruleMaxNameLength) { _lastError = string.Format(CultureService.Instance.GetString(CultureText.text_SymbolNameMaxLength), ruleMaxNameLength); return(_lastError); } var item = Columns.Count(n => n.Name == (string)value); if (item != 1) { _lastError = CultureService.Instance.GetString(CultureText.text_AlreadyExists); return(_lastError); } _lastError = null; return(null); } #endregion #region Shift else if (columnName == PropertyPlus.GetPropertyName(() => Shift)) { const int ruleMaxShiftValue = 31; var value = (int)typeof(CustomArbIdColumnItem).GetProperty(PropertyPlus.GetPropertyName(() => Shift)).GetValue(this, null); if (value < 0) { _lastError = CultureService.Instance.GetString(CultureText.text_ItCanNotBeANegativeNumber); return(_lastError); } else if (value > ruleMaxShiftValue) { _lastError = string.Format(CultureService.Instance.GetString(CultureText.text_TheShiftIsTooLargeUpTo), ruleMaxShiftValue); return(_lastError); } } #endregion #region StartBit else if (columnName == PropertyPlus.GetPropertyName(() => StartBit)) { const int ruleMaxStartBitValue = 31; var value = (int)typeof(CustomArbIdColumnItem).GetProperty(PropertyPlus.GetPropertyName(() => StartBit)).GetValue(this, null); if (value < 0) { _lastError = CultureService.Instance.GetString(CultureText.text_ItCanNotBeANegativeNumber); return(_lastError); } else if (value > ruleMaxStartBitValue) { _lastError = string.Format(CultureService.Instance.GetString(CultureText.text_ItCanNotBeMoreThan), ruleMaxStartBitValue); return(_lastError); } } #endregion #region LengthBit else if (columnName == PropertyPlus.GetPropertyName(() => LengthBit)) { const int ruleMaxLengthValue = 32; var value = (int)typeof(CustomArbIdColumnItem).GetProperty(PropertyPlus.GetPropertyName(() => LengthBit)).GetValue(this, null); if (value < 0) { _lastError = CultureService.Instance.GetString(CultureText.text_ItCanNotBeANegativeNumber); return(_lastError); } else if (value > ruleMaxLengthValue) { _lastError = string.Format(CultureService.Instance.GetString(CultureText.text_ItCanNotBeMoreThan), ruleMaxLengthValue); return(_lastError); } else if (value == 0) { _lastError = CultureService.Instance.GetString(CultureText.text_TheValueCanNotBeNull); return(_lastError); } } #endregion #region Description else if (columnName == PropertyPlus.GetPropertyName(() => Description)) { const int ruleMaxDescriptionLength = 255; var value = (string)typeof(CustomArbIdColumnItem).GetProperty(PropertyPlus.GetPropertyName(() => Description)).GetValue(this, null); if (value != null && value.Length > ruleMaxDescriptionLength) { _lastError = CultureService.Instance.GetString(CultureText.text_TheTextIsTooLong) + string.Format(CultureService.Instance.GetString(CultureText.text_ItCanNotBeMoreThan), ruleMaxDescriptionLength); return(_lastError); } } #endregion _lastError = null; return(null); }
public LogView() { InitializeComponent(); #region Log File események EventAggregator.Instance.Subscribe <LogFileAppEvent>(e => { switch (e.ChangingType) { case FileChangingType.LoadComplete: { LogGrid.Source = e.LogFile.Messages; DescriptionView.Content = e.LogFile.Info.Description; DescriptionView.LogName = e.LogFile.Name; LogGrid.AllowClick = true; //LogGrid.TimestampFormat = "HH"; break; } case FileChangingType.Loading: { LogGrid.AllowClick = false; LogGrid.Source = null; DescriptionView.Content = ""; DescriptionView.LogName = "*"; break; } case FileChangingType.LoadCorrupted: { LogGrid.AllowClick = true; LogGrid.Source = null; DescriptionView.Content = ""; DescriptionView.LogName = "Loading Corrupted... Please try again."; break; } case FileChangingType.UnLoadComplete: { LogGrid.AllowClick = true; LogGrid.Source = null; DescriptionView.Content = ""; DescriptionView.LogName = "*"; break; } default: { break; } } }); #endregion #region Project File események EventAggregator.Instance.Subscribe <StorageAppEvent>((e1) => { switch (e1.ChangingType) { case FileChangingType.Loading: { LogGrid.GridLayout = null; LogGrid.DefaultLayout(); break; } case FileChangingType.LoadComplete: { LogGrid.CustomArbIdColumns = e1.Storage.CustomArbIdColumns; LogGrid.GridLayout = e1.Storage.LogGridLayout; LogGrid.TimestampFormat = e1.Storage.Parameters.TimestampFormat; break; } case FileChangingType.Saving: { LogGrid.GridLayout.CopyTo(e1.Storage.LogGridLayout); break; } case FileChangingType.ContentChanged: { if (e1.Details.DataObjects == DataObjects.ParameterProperty) { if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.ArbitrationIdFormat) || e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.DataFormat)) { /*Converterek miatt újra kell rajzolni a Grid-et*/ /*Ez kritikus! ha egy sor törlésekor jön egy esemény ami frssíti a DGV-az DGV hibhoz vezet!*/ LogGrid.Refresh(); } if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.TimestampFormat)) { LogGrid.TimestampFormat = e1.Storage.Parameters.TimestampFormat; } } break; } } }); #endregion }
public Presenter( IStatisticsGridView gridView, MessageStatistics statistics, Storage project) { gridView.Source = statistics.Messages; gridView.Menu.Items.AddRange( new ToolStripItem[] { new ClearCommand(statistics), new DefaultCommand(statistics, gridView), new EnabledCommand(project), new ExportCommand(project, gridView), }); #region Project események EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { switch (e1.ChangingType) { case FileChangingType.Loading: { break; } case FileChangingType.LoadComplete: { project = e1.Storage; gridView.AllowClick = true; gridView.GridLayout = e1.Storage.StatisticsGridLayout; gridView.TimestampFormat = e1.Storage.Parameters.TimestampFormat; if (e1.Storage.Parameters.MessageStatisticsEnabled) { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_STATISTICS); } else { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_STATISTICS); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_DISABLED); } gridView.Refresh(); break; } case FileChangingType.Saving: { /*GridLayout hozza létre a default értéket és nem a project File.. ezért * mentés előtt átt kell adni a projectnek a layout listákat.*/ gridView.GridLayout.CopyTo(e1.Storage.StatisticsGridLayout); break; } case FileChangingType.ContentChanged: { /*Célzott frssítések*/ if (e1.Details.DataObjects == DataObjects.ParameterProperty) { if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.ArbitrationIdFormat) || e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.DataFormat)) { /*Converterek miatt újra kell rajzolni a Grid-et*/ /*Ez kritikus! ha egy sor törlésekor jön egy esemény ami frssíti a DGV-az DGV hibhoz vezet!*/ gridView.Refresh(); } else if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.TimestampFormat)) { gridView.TimestampFormat = e1.Storage.Parameters.TimestampFormat; } else if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.MessageStatisticsEnabled)) { if (e1.Storage.Parameters.MessageStatisticsEnabled) { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_STATISTICS); } else { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_STATISTICS); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_DISABLED); } } } break; } } }); #endregion #region Adapter események EventAggregator.Instance.Subscribe <PlayAppEvent>(e => { /*Periodikus frsstés itt indul.*/ gridView.Start(); gridView.RefreshRate = Settings.Default.dataGridViewStatisticsRefreshRateMs; }); EventAggregator.Instance.Subscribe <StopAppEvent>(e => { /*Periodikus frsstés itt leáll.*/ gridView.Stop(); }); #endregion }
public Presenter(IFiltersGridView gridView, MessageFilterCollection collection, Storage storage, ProjectParameters parameters) { gridView.Menu.Items.AddRange( new ToolStripItem[] { new NewCommand(gridView.DataGridViewBase, collection), new CopyRowsCommand(gridView.DataGridViewBase, collection), new CutRowsCommand(gridView.DataGridViewBase, collection), new PasteRowsCommand(gridView.DataGridViewBase, collection), new DeleteRowsCommand(gridView.DataGridViewBase, collection), new DefaultCommand(collection), new EnabledCommand(parameters), new ExportCommand(storage, gridView), }); gridView.Source = collection; EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { switch (e1.ChangingType) { case FileChangingType.Loading: { gridView.DefaultLayout(); break; } case FileChangingType.LoadComplete: { gridView.GridLayout = e1.Storage.FilterGridLayout; if (e1.Storage.Parameters.FiltersEnabled) { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_FILTERS); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_ENABLED); } else { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_FILTERS); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_DISABLED); } gridView.Refresh(); break; } case FileChangingType.Saving: { /*GridLayout hozza létre a default értéket és nem a project File.. ezért * mentés előtt átt kell adni a projectnek a layout listákat.*/ gridView.GridLayout.CopyTo(e1.Storage.FilterGridLayout); break; } case FileChangingType.ContentChanged: { /*Célzott frssítések*/ if (e1.Details.DataObjects == DataObjects.ParameterProperty) { if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.ArbitrationIdFormat)) { /*Converterek miatt újra kell rajzolni a Grid-et*/ /*Ez kritikus! ha egy sor törlésekor jön egy esemény ami frssíti a DGV-az DGV hibhoz vezet!*/ gridView.Refresh(); } if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.FiltersEnabled)) { if (e1.Storage.Parameters.FiltersEnabled) { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_FILTERS); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_ENABLED); } else { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_FILTERS); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_DISABLED); } } } break; } } }); }
public Presenter(ITraceGridView gridView, MessageTraceCollection collection, ProjectParameters parameters) { gridView.Source = collection; gridView.ContextMenuStrip.Items.AddRange( new ToolStripItem[] { new Commands.ClearTraceCommand(collection), new Commands.AutoSizeAllCommand(gridView), new Commands.AutoScrolllCommand(gridView), new Commands.EnabledCommand(parameters), new Commands.FullscreenCommand(gridView), }); EventAggregator.Instance.Subscribe <StorageAppEvent>(e1 => { switch (e1.ChangingType) { case FileChangingType.Loading: { gridView.DefaultLayout(); gridView.Source.Clear(); break; } case FileChangingType.LoadComplete: { gridView.GridLayout = e1.Storage.TraceGridLayout; gridView.TimestampFormat = e1.Storage.Parameters.TimestampFormat; if (e1.Storage.Parameters.TraceEnabled) { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_TRACE); } else { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_TRACE); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_DISABLED); } break; } case FileChangingType.Saving: { /*GridLayout hozza létre a default értéket és nem a project File.. ezért * mentés előtt átt kell adni a projectnek a layout listákat.*/ gridView.GridLayout.CopyTo(e1.Storage.TraceGridLayout); break; } case FileChangingType.ContentChanged: { /*Célzott frssítések*/ if (e1.Details.DataObjects == DataObjects.ParameterProperty) { if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.TimestampFormat)) { gridView.TimestampFormat = e1.Storage.Parameters.TimestampFormat; } else if (e1.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e1.Storage.Parameters.TraceEnabled)) { if (e1.Storage.Parameters.TraceEnabled) { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_TRACE); } else { gridView.BackgroundText = CultureService.Instance.GetString(CultureText.text_TRACE); gridView.BackgroundText += " "; gridView.BackgroundText += CultureService.Instance.GetString(CultureText.text_DISABLED); } } } break; } } }); EventAggregator.Instance.Subscribe <PlayAppEvent>(e => { /*Periodikus frsstés itt indul.*/ gridView.Start(); gridView.RefreshRate = Settings.Default.dataGridViewTraceRefreshRateMs; }); EventAggregator.Instance.Subscribe <StopAppEvent>(e => { /*Periodikus frsstés itt leáll.*/ gridView.Stop(); }); }