public MonitorViewModel(IDistributorMonitorProxy distributorMonitorProxy,ListAvailableChannelsResponse listAvailableComponentsTreeResponse, int localDistributorPort) { _localDistributorPort = localDistributorPort; _distributorMonitorProxy = distributorMonitorProxy; DistributorName = listAvailableComponentsTreeResponse.Name; var availableChannels = listAvailableComponentsTreeResponse.Channels; AvailableChannels = new ObservableCollection<AvailableChannelViewModel>(); AvailableChannels = availableChannels.AddToChannels(AvailableChannels); _timer = new Timer(); _timer.Interval = 10000; }
public void ConnectToADistributor(EventHandler<ProgressChangedEventArgs> progressChanged, int localDistributorPort, out IDistributorMonitorProxy distributorMonitorProxy, out ListAvailableChannelsResponse availableComponents) { progressChanged(this, new ProgressChangedEventArgs(0, "Connecting to Distributor at port: " + localDistributorPort)); distributorMonitorProxy = new DistributorMonitorClient(); distributorMonitorProxy.InitiateUsingPort(localDistributorPort); progressChanged(this, new ProgressChangedEventArgs(0, "Connected to Distributor at port: " + localDistributorPort + " checking registrations...")); availableComponents = distributorMonitorProxy.ListAvailableChannels(); progressChanged(this, new ProgressChangedEventArgs(0, string.Format( "{0} channels registered at the distributor", availableComponents.Channels.Count()))); }
public MonitorView(int localDistributorPort,IDistributorMonitorProxy distributorProxy=null,ListAvailableChannelsResponse listAvailableComponentsTreeResponse=null) { InitializeComponent(); try { var monitorViewModel = new MonitorViewModel(distributorProxy,listAvailableComponentsTreeResponse,localDistributorPort); monitorViewModel.InitiateView(); this.DataContext = monitorViewModel; } catch (Exception ex) { LoggingManager.LogMySynchSystemError(ex); throw; } }
private void ParseDistributorInformation(ListAvailableChannelsResponse distributorInformation) { var currentNode = new NotificationDetailsViewModel {Name = distributorInformation.Name, Type = ComponentType.Distributor,IsExpanded=true,TypeColor=Brushes.Peru}; NotificationDetailsCollection.Add(currentNode); //ParsePublishersInformation(currentNode, distributorInformation.Channels); }
private void DoWork(object sender, DoWorkEventArgs e) { DoWorkProgressChanged(this,new ProgressChangedEventArgs(0,"Reevaluating all channels in the distributor.")); DoWorkProgressChanged(this, new ProgressChangedEventArgs(0,ServiceHelper.StopDistributor())); DoWorkProgressChanged(this, new ProgressChangedEventArgs(0,"Starting distributor...")); DoWorkProgressChanged(this, new ProgressChangedEventArgs(0, ServiceHelper.StartDistributor())); var clienHelper = new ClientHelper(); clienHelper.DisconnectFromADistributor(DoWorkProgressChanged,_localDistributorPort,_distributorMonitorProxy); ListAvailableChannelsResponse availableChannels= new ListAvailableChannelsResponse(); clienHelper.ConnectToADistributor(DoWorkProgressChanged, _localDistributorPort, out _distributorMonitorProxy, out availableChannels); DoWorkProgressChanged(this, new ProgressChangedEventArgs(0, "Listing all channels in the distributor.")); DistributorName = availableChannels.Name; AvailableChannels = new ObservableCollection<AvailableChannelViewModel>(); AvailableChannels = availableChannels.Channels.AddToChannels(AvailableChannels); }