Exemplo n.º 1
0
        public AdapterService(
            MessageTraceCollection tracer,
            ProjectParameters paramters,
            IAdapterStatistics adapterStat,
            MessageStatistics messageStat,
            Storage project,

            ToolTableCollection toolTables)
        {
            _messageTrace = tracer;
            _adapterStat  = adapterStat;
            _messageStat  = messageStat;
            _paramters    = paramters;
            _project      = project;

            _toolTables = toolTables;
            _txQueue    = new SafeQueue <CommonCanMessage>();
        }
        public DefaultNodeCommand(IAdapterStatistics statistics)
        {
            _statistics = statistics;
            Image       = Resources.Synchronize_16x16;
            Text        = CultureService.Instance.GetString(CultureText.menuItem_Reset_Text);

            EventAggregator.Instance.Subscribe <TreeViewSelectionChangedAppEvent>(e =>
            {
                if (e.SelectedNode is AdapterStatisticsTreeNode)
                {
                    Visible = true;
                    _node   = e.SelectedNode;
                }
                else
                {
                    Visible = false;
                }
            });
        }
Exemplo n.º 3
0
        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;
                    }
                }
            });
        }