Exemplo n.º 1
0
        /// <summary>
        /// Merges the plug-in's resources.
        /// </summary>
        /// <param name="dictionary">The dictionary.</param>
        private static void MergeResources(ResourceDictionary dictionary)
        {
            try
            {
                foreach (var resourcePlugin in LoadResourcesPlugins)
                {
                    try
                    {
                        foreach (var resource in resourcePlugin.GetResources())
                        {
                            dictionary.MergedDictionaries.Add(resource);
                        }
                    }

                    #region Exception Handling

                    catch (Exception ex)
                    {
                        TraceSourceMonitorHelper.Error("Fail to get resource [plug-in = {0}]: {1}", resourcePlugin.GetType().Name, ex);
                    }

                    #endregion Exception Handling
                }
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("Fail to add plug-ins resources: {0}", ex);
            }

            #endregion Exception Handling
        }
Exemplo n.º 2
0
        private static void CreateQueueIfNotExists(string queueName)
        {
            #region Validation

            if (string.IsNullOrWhiteSpace(queueName))
            {
                return;
            }

            #endregion // Validation

            try
            {
                string queueFullName = ".\\private$\\" + queueName;
                if (!MessageQueue.Exists(queueFullName))
                {
                    MessageQueue.Create(queueFullName, false);
                }
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("Fail to create MSMQ queue: {0}", ex);
            }

            #endregion Exception Handling
        }
            /// <summary>
            /// Pings this instance.
            /// </summary>
            public async void Ping()
            {
                var factory = _factory;

                try
                {
                    var proxy = GetProxy(factory);
                    await proxy.PingAsync();
                }
                #region Exception Handling

                //catch (CommunicationException ex)
                //{
                //    factory.Abort();
                //    TraceSourceMonitorHelper.Error("Ping CommunicationException: {0}", ex);
                //}
                //catch (TimeoutException ex)
                //{
                //    factory.Abort();
                //    TraceSourceMonitorHelper.Error("Ping timeout: {0}", ex);
                //}
                catch (Exception ex)
                {
                    //factory.Abort();
                    TraceSourceMonitorHelper.Error("Ping failed: {0}", ex);
                }

                #endregion // Exception Handling
            }
        /// <summary>
        /// Loads the configuration.
        /// </summary>
        public static void Load()
        {
            if (!File.Exists(FILE_PATH))
            {
                Save();
                return;
            }

            try
            {
                var ser = new NetDataContractSerializer();
                var fs  = File.OpenRead(FILE_PATH);
                using (var crypto = new CryptoStream(fs, _cryptoAlgorithm.CreateDecryptor(), CryptoStreamMode.Read))
                {
                    Value = ser.Deserialize(crypto) as Configuration;
                }
            }
            #region Exception Handling

            catch (Exception ex)
            {
                string date = DateTime.Now.ToString("yyyyMMdd.HHmmss");
                File.Move(FILE_PATH, FILE_PATH + "." + date);
                Value = new Configuration();
                Save();
                TraceSourceMonitorHelper.Error("Fail to load the Configuration: {0}", ex);
            }

            #endregion // Exception Handling
        }
            public void Dispose()
            {
                var factory = _factory;

                if (factory == null)
                {
                    return;
                }
                if (Interlocked.CompareExchange(ref _factory, null, factory) != factory)
                {
                    return;
                }

                try
                {
                    if (factory.State == CommunicationState.Faulted)
                    {
                        factory.Abort();
                    }
                    else
                    {
                        factory.Close();
                    }
                }
                catch (Exception ex)
                {
                    TraceSourceMonitorHelper.Error("Dispose: close factory failed: {0}", ex);
                }
                GC.SuppressFinalize(this);
            }
Exemplo n.º 6
0
        /// <summary>
        /// Selects a template from the Tab.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="container">The container.</param>
        /// <returns></returns>
        public override DataTemplate SelectTemplate(object model, DependencyObject container)
        {
            FrameworkElement element = container as FrameworkElement;
            var tabModel             = model as ITabModel;

            ITabPlugin plugin =
                MarbleController.TabTemplateSelectorPlugins.FirstOrDefault(
                    p => p.TabModel.Keyword == tabModel.Keyword);

            if (plugin != null)
            {
                try
                {
                    DataTemplate template = plugin.SelectTemplate(tabModel, element);
                    if (template != null)
                    {
                        return(template);
                    }
                }

                #region Exception Handling

                catch (Exception ex)
                {
                    TraceSourceMonitorHelper.Error("Fail to select template for tab, plugins: {0}, \r\n\terror = {1}",
                                                   plugin.TabModel.Keyword, ex);
                    return(null);
                }

                #endregion Exception Handling
            }
            return(element.FindResource("DiagramsTemplate") as DataTemplate);
        }
Exemplo n.º 7
0
        /// <summary>
        /// select the template for the marble diagram
        /// </summary>
        /// <param name="item">The data object for which to select the template.</param>
        /// <param name="container">The data-bound object.</param>
        /// <returns>
        /// Returns a <see cref="T:System.Windows.DataTemplate"/> or null. The default value is null.
        /// </returns>
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var element       = container as FrameworkElement;
            var marbleDiagram = item as IMarbleDiagramContext;

            IMarblePanelPlugin[] plugins =
                MarbleController.MarbleDiagramTemplateSelectorPlugin.ToArray();

            foreach (var plugin in plugins)
            {
                try
                {
                    DataTemplate template = plugin.SelectTemplate(marbleDiagram, element);
                    if (template != null)
                    {
                        return(template);
                    }
                }

                #region Exception Handling

                catch (Exception ex)
                {
                    TraceSourceMonitorHelper.Error("Fail to select template for marble diagram, plugins: {0}, \r\n\terror = {1}",
                                                   plugin, ex);
                    return(null);
                }

                #endregion Exception Handling
            }
            return(element.FindResource("DiagramTemplate") as DataTemplate);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <returns>Initialize information</returns>
        public string Initialize()
        {
            #region _scheduler = new EventLoopScheduler(...)

            _scheduler = new EventLoopScheduler(treadStart =>
                {
                    var trd = new Thread(treadStart);
                    trd.Priority = ThreadPriority.Normal;
                    trd.IsBackground = true;
                    trd.Name = "Monitor Proxy " + Kind;

                    return trd;
                });

            _scheduler.Catch<Exception>(e =>
                {
                    TraceSourceMonitorHelper.Error("Scheduling (OnBulkSend): {0}", e);
                    return true;
                });

            #endregion _scheduler = new EventLoopScheduler(...)

            SendThreshold threshhold = _actualProxy.SendingThreshold ?? _defaultThreshold;
            
            _subject = new Subject<MarbleBase>();
            var tmpStream = _subject
                .ObserveOn(_scheduler) // single thread
                //.Synchronize()
                .Retry()
                .Buffer(threshhold.WindowDuration, threshhold.WindowCount)
                .Where(items => items.Count != 0);
            _unsubSubject = tmpStream.Subscribe(_actualProxy.OnBulkSend);

            return _actualProxy.OnInitialize();
        }
            /// <summary>
            /// Sends the specified item.
            /// </summary>
            /// <param name="item">The item.</param>
            public async void Send(MarbleBase[] item)
            {
                var factory = _factory;

                try
                {
                    var proxy = GetProxy(factory);
                    await proxy.SendAsync(item);
                }
                #region Exception Handling

                //catch (CommunicationException ex)
                //{
                //    factory.Abort();
                //    TraceSourceMonitorHelper.Error("Send CommunicationException: {0}", ex);
                //}
                //catch (TimeoutException ex)
                //{
                //    factory.Abort();
                //    TraceSourceMonitorHelper.Error("Send timeout: {0}", ex);
                //}
                catch (Exception ex)
                {
                    //factory.Abort();
                    TraceSourceMonitorHelper.Error("Send failed: {0}", ex);
                }

                #endregion // Exception Handling
            }
Exemplo n.º 10
0
        /// <summary>
        /// Called when [setting handler].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OnSettingHandler(object sender, RoutedEventArgs e)
        {
            try
            {
                SettingWindow win = null;
                try
                {
                    win       = new SettingWindow();
                    win.Owner = this;
                    win.ShowDialog();
                }
                finally
                {
                    win.Close();
                }
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("UI event handler failed: {0}", ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 11
0
        /// <summary>
        /// Plug-ins the discovery.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        private static void PluginDiscovery(Configuration configuration)
        {
            try
            {
                #region AggregateCatalog aggregateCatalog = ...

                var allTabCatalog    = new TypeCatalog(typeof(DefaultPlugin));
                var aggregateCatalog = new AggregateCatalog(allTabCatalog);

                #region Plug-in catalogs

                string[] commandlines = GetPluginFoldersFromCommandline();
                var      paths        = from path in commandlines
                                        .Union(configuration.PluginDiscoveryPaths.Select(v => v.Path))
                                        .Distinct()
                                        where !string.IsNullOrWhiteSpace(path)
                                        select path;

                foreach (var path in paths)
                {
                    if (Directory.Exists(path))
                    {
                        var catalog = new DirectoryCatalog(path);
                        aggregateCatalog.Catalogs.Add(catalog);
                    }
                    else
                    {
                        TraceSourceMonitorHelper.Warn("Discovery path not found: {0}", path);
                    }
                }

                #endregion // Plug-in catalogs

                #endregion AggregateCatalog aggregateCatalog = ...

                var container = new CompositionContainer(aggregateCatalog);

                var plugins        = container.GetExportedValues <IPluginBundle>().Distinct().ToArray();
                var plugActivation = configuration.PluginsActivation;
                if (plugActivation == null)
                {
                    configuration.PluginsActivation = new ConcurrentDictionary <Guid, bool>();
                    plugActivation = configuration.PluginsActivation;
                    foreach (var p in plugins)
                    {
                        plugActivation.TryAdd(p.Id, true);
                    }
                }
                Plugins = (from p in plugins
                           select new PluginVM(p)).ToArray();
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("Fail to load plugins: {0}", ex);
            }

            #endregion Exception Handling
        }
Exemplo n.º 12
0
 protected override void Dispose(bool disposed)
 {
     try
     {
         _trace.Close();
     }
     catch (Exception ex)
     {
         TraceSourceMonitorHelper.Error("VisualRxTraceSourceProxy: {0}", ex);
     }
 }
 protected override void Dispose(bool disposed)
 {
     try
     {
         _proxy.Value.Dispose();
     }
     catch (Exception ex)
     {
         TraceSourceMonitorHelper.Error("VisualRxWcfFixedAddressProxy: {0}", ex);
     }
 }
Exemplo n.º 14
0
            /// <summary>
            /// Discovers this listeners.
            /// </summary>
            private bool Discover()
            {
                lock (_sync)
                {
                    if (_isDiscovering)
                    {
                        return(false);
                    }
                    _isDiscovering = true;
                }
                try
                {
                    var client = new DiscoveryClient(new UdpDiscoveryEndpoint());

                    var criteria = new FindCriteria(typeof(IVisualRxServiceAdapter));
                    criteria.Duration = TimeSpan.FromSeconds(_setting.DiscoveryTimeoutSeconds);

                    var endpoints         = client.Find(criteria).Endpoints;
                    var addressesNamepipe = (from item in endpoints
                                             where item.Address.Uri.Scheme == CHANNEL_TYPE_NAMEPIPE
                                             select item.Address).ToArray();
                    var addressesTcp = (from item in endpoints
                                        where item.Address.Uri.Scheme == CHANNEL_TYPE_TCP
                                        select item.Address).ToArray();

                    string[] oldProxies = _liveChannels.Keys.ToArray();

                    AddProxies(addressesTcp, () => new NetTcpBinding());
                    AddProxies(addressesNamepipe, () => new NetNamedPipeBinding());

                    string[] forCleanup = oldProxies.Except(_liveChannels.Keys).ToArray();

                    Cleanup(forCleanup);
                }

                #region Exception Handling

                catch (Exception ex)
                {
                    TraceSourceMonitorHelper.Error("Monitor channel discovery: ", ex);
                }

                #endregion Exception Handling

                finally
                {
                    lock (_sync)
                    {
                        _isDiscovering = false;
                    }
                }

                return(true);
            }
Exemplo n.º 15
0
 public void Dispose()
 {
     try
     {
         _factory.Close();
     }
     catch (Exception ex)
     {
         TraceSourceMonitorHelper.Error("Dispose: close factory failed: {0}", ex);
     }
     GC.SuppressFinalize(this);
 }
Exemplo n.º 16
0
        /// <summary>
        /// Saves the configuration.
        /// </summary>
        /// <returns></returns>
        public static Exception Save()
        {
            try
            {
                ObservableCollection <DiscoveryPath> paths = Value.PluginDiscoveryPaths;
                #region Validation

                for (int i = paths.Count - 1; i >= 0; i--)
                {
                    if (string.IsNullOrWhiteSpace(paths[i].Path))
                    {
                        paths.RemoveAt(i);
                    }
                }

                #region Validation

                if (File.Exists(FILE_PATH))
                {
                    File.Delete(FILE_PATH);
                }

                #endregion // Validation

                #endregion // Validation

                var ser = new NetDataContractSerializer();
                var fs  = File.OpenWrite(FILE_PATH);
                using (var crypto = new CryptoStream(fs, _cryptoAlgorithm.CreateEncryptor(), CryptoStreamMode.Write))
                {
                    ser.Serialize(crypto, Value);
                }
                return(null);
            }
            #region Exception Handling

            catch (Exception ex)
            {
                try
                {
                    File.Move(FILE_PATH, FILE_PATH + "." + DateTime.Now.ToString("yyyy-MM-dd HHmmss"));
                }
                #region Exception Handling

                catch { }

                #endregion // Exception Handling
                TraceSourceMonitorHelper.Error("Fail to Save the Configuration: {0}", ex);
                return(ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 17
0
 public static void SetDispatcher()
 {
     if (CurrentDispatcher != null)
     {
         throw new InvalidOperationException("Only single assignment is allowed");
     }
     CurrentDispatcher = Dispatcher.CurrentDispatcher;
     CurrentDispatcher.Hooks.OperationAborted += (s, e) =>
                                                 TraceSourceMonitorHelper.Warn("UI abort: {0}", e.Operation.Status);
     CurrentDispatcher.UnhandledException += (s, e) =>
                                             TraceSourceMonitorHelper.Error("UI unhandled error: {0}", e.Exception);
 }
Exemplo n.º 18
0
        /// <summary>
        /// Called when [close handler].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OnCloseHandler(object sender, RoutedEventArgs e)
        {
            try
            {
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("UI event handler failed: {0}", ex);
            }

            #endregion // Exception Handling
            this.Close();
        }
Exemplo n.º 19
0
        /// <summary>
        /// Called when [hide handler].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OnHideHandler(object sender, RoutedEventArgs e)
        {
            try
            {
                this.WindowState = Windows.WindowState.Minimized;
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("UI event handler failed: {0}", ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 20
0
        /// <summary>
        /// Bulk send.
        /// </summary>
        /// <param name="items">The items.</param>
        public void OnBulkSend(IEnumerable <MarbleBase> items)
        {
            try
            {
                _service.Send(items.ToArray());
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("MonitorWcfDiscoveryProxy: {0}", ex);
            }

            #endregion Exception Handling
        }
Exemplo n.º 21
0
        /// <summary>
        /// Called when [pause handler].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OnPauseHandler(object sender, RoutedEventArgs e)
        {
            try
            {
                MarbleController.ViewModel.TogglePause();
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("UI event handler failed: {0}", ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 22
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposed"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        private void DisposeInternal(bool disposed)
        {
            try
            {
                IDisposable unsubSubject = _unsubSubject;
                if (unsubSubject != null)
                    unsubSubject.Dispose();

                _actualProxy.Dispose();

                Dispose(disposed);
            }
            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("VisualRxTraceSourceProxy: {0}", ex);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        ///  Enforce the dispose
        /// </summary>
        /// <param name="disposing"></param>
        #endregion // Documentation
        private void Dispose(bool disposing)
        {
            try
            {
                var pauseSubject = _pauseSubject as IDisposable;
                if (pauseSubject != null)
                {
                    pauseSubject.Dispose();
                }
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("Dispose filed: {0}", ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 24
0
        /// <summary>
        /// Called when [drag handler].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param>
        private void OnDragHandler(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (WindowState == WindowState.Maximized)
                {
                    this.Top    = 1;
                    WindowState = WindowState.Normal;
                }
                this.DragMove();
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("UI event handler failed: {0}", ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 25
0
        /// <summary>
        /// Called when [resize].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.Primitives.DragDeltaEventArgs"/> instance containing the event data.</param>
        private void OnResize(object sender, DragDeltaEventArgs e)
        {
            try
            {
                var str = (string)((Thumb)sender).Tag;

                if (str.Contains("T"))
                {
                    double height = Math.Min(Math.Max(this.MinHeight, this.ActualHeight - e.VerticalChange), this.MaxHeight);
                    double gap    = (height - this.Height);
                    this.Height += gap;
                    this.Top    -= gap;
                }
                if (str.Contains("L"))
                {
                    double width = Math.Min(Math.Max(this.MinWidth, this.ActualWidth - e.HorizontalChange), this.MaxWidth);
                    double gap   = (width - this.Width);

                    this.Width += gap;
                    this.Left  -= gap;
                }
                if (str.Contains("B"))
                {
                    this.Height = Math.Min(Math.Max(this.MinHeight, this.ActualHeight + e.VerticalChange), this.MaxHeight);
                }
                if (str.Contains("R"))
                {
                    this.Width = Math.Min(Math.Max(this.MinWidth, this.ActualWidth + e.HorizontalChange), this.MaxWidth);
                }

                e.Handled = true;
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("UI event handler failed: {0}", ex);
            }

            #endregion // Exception Handling
        }
Exemplo n.º 26
0
        /// <summary>
        /// Ensures the directory exists.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns></returns>
        private static bool EnsureDirectoryExists(string path)
        {
            try
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(DEF_PLUGIN_FOLDER);
                }
            }
            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("Fail to create plug-in polder: {0}\r\n{1}",
                                               DEF_PLUGIN_FOLDER, ex);
                return(false);
            }

            #endregion Exception Handling
            return(true);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Tries the select custom template.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="element">The element.</param>
        /// <param name="plugin">The plugin.</param>
        /// <returns></returns>
        private DataTemplate TrySelectCustomTemplate(
            IMarbleItemPlugin plugin,
            MarbleBase item,
            FrameworkElement element)
        {
            try
            {
                return(plugin.SelectTemplate(item, element));
            }

            #region Exception Handling

            catch (Exception ex)
            {
                TraceSourceMonitorHelper.Error("Fail to select template for marble item, plugins: {0}, item = {1}, \r\n\terror = {2}",
                                               plugin, item.Value, ex);
                return(null);
            }

            #endregion Exception Handling
        }
            /// <summary>
            /// Sends the specified item.
            /// </summary>
            /// <param name="item">The item.</param>
            public async void Send(MarbleBase[] item)
            {
                var factory = _factory;

                try
                {
                    var proxy = GetProxy(factory);
                    if (proxy == null)
                    {
                        return;
                    }
                    await proxy.SendAsync(item);
                }
                #region Exception Handling

                //catch (CommunicationException ex)
                //{
                //    factory.Abort();
                //    TraceSourceMonitorHelper.Error("Send CommunicationException: {0}", ex);
                //}
                //catch (TimeoutException ex)
                //{
                //    factory.Abort();
                //    TraceSourceMonitorHelper.Error("Send timeout: {0}", ex);
                //}
                catch (Exception ex)
                {
                    try
                    {
                        if (Interlocked.CompareExchange(ref _factory, null, factory) == factory)
                        {
                            factory.Abort(); // abort once
                        }
                    }
                    catch { }
                    TraceSourceMonitorHelper.Error("Send failed: {0}", ex);
                }

                #endregion // Exception Handling
            }
Exemplo n.º 29
0
        /// <summary>
        /// Removes the proxies.
        /// </summary>
        /// <param name="proxies">The proxies.</param>
        /// <exception cref="System.ArgumentException">missing proxies</exception>
        public static void RemoveProxies(params IVisualRxProxy[] proxies)
        {
            if (proxies == null || !proxies.Any())
            {
                throw new ArgumentException("missing proxies");
            }

            lock (_syncProxies)
            {
                IEnumerable <VisualRxProxyWrapper> left =
                    from w in Proxies
                    where !proxies.Any(p => p == w.ActualProxy)
                    select w;

                Proxies = left.ToArray();
            }
            Task.Factory.StartNew(state =>
            {
                #region Dispose

                var removed = state as IVisualRxProxy[];
                foreach (var p in removed)
                {
                    try
                    {
                        p.Dispose();
                    }
                    #region Exception Handling

                    catch (Exception ex)
                    {
                        TraceSourceMonitorHelper.Error("Dispose proxy: [{0}]\t{1}", p.Kind, ex);
                    }

                    #endregion     // Exception Handling
                }

                #endregion     // Dispose
            }, proxies);
        }
Exemplo n.º 30
0
 /// <summary>
 /// Toggles the pause.
 /// </summary>
 public void TogglePause()
 {
     try
     {
         if (PauseState == PAUSE_TEXT)
         {
             _pauseSubject = new ReplaySubject <MarbleItemViewModel>();
             PauseState    = RESUME_TEXT;
         }
         else
         {
             PauseState = PAUSE_TEXT;
             _pauseSubject
             .ObserveOn(SynchronizationContext.Current)
             .Subscribe(AppendMarble);
         }
     }
     catch (Exception ex)
     {
         TraceSourceMonitorHelper.Error("Pause toggle filed: {0}", ex);
     }
 }