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; } }
public NotificationDetailsViewModel(IDistributorMonitorProxy distributorMonitorProxy) { using (LoggingManager.LogMySynchPerformance()) { TreeReady = Visibility.Hidden; TreeNotReady = Visibility.Visible; _timer= new Timer(); _timer.Interval = 10000; _distributorMonitorProxy = distributorMonitorProxy; BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); backgroundWorker.RunWorkerAsync(); } }
public void DisconnectFromADistributor(EventHandler<ProgressChangedEventArgs> progressChanged, int localDistributorPort, IDistributorMonitorProxy distributorMonitorProxy) { progressChanged(this, new ProgressChangedEventArgs(0, "Disconnecting from Distributor at port: " + localDistributorPort)); distributorMonitorProxy.DestroyAtPort(localDistributorPort); progressChanged(this, new ProgressChangedEventArgs(0, "Disconnected from Distributor at port: " + localDistributorPort + " checking registrations...")); }