private void cmdTestWithStorrage_Click(object sender, RoutedEventArgs e)
        {
            lblError.Text = "";

            string err = ProtokollerConfiguration.ActualConfigInstance.CheckConfiguration(true);
            if (err != null)
            {
                lblError.Text = err;
                return;
            }
                
            try
            {
                using (myInstance = new ProtokollerInstance(ProtokollerConfiguration.ActualConfigInstance))
                {
                    myInstance.StartTestMode();
                    myInstance.TestDataReadWrite((DatasetConfig)cmbTriggerConnection.SelectedValue);
                    Thread.Sleep(1500);
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
                return;
            }
            lblError.Text = "OK!";
        }
 protected override void OnStart(string[] args)
 {
     try
     {
         ProtokollerConfiguration.Load();
         myInstance = new ProtokollerInstance(ProtokollerConfiguration.ActualConfigInstance);
         myInstance.Start(true);
     }
     catch (Exception ex)
     {
         Logging.LogText("Exception occured! ",ex, Logging.LogLevel.Error);
     }
 }
        protected override void OnStart(string[] args)
        {
            try
            {
                TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;


                ProtokollerConfiguration.Load();
                myInstance = new ProtokollerInstance(ProtokollerConfiguration.ActualConfigInstance);
                myInstance.Start(true);
            }
            catch (Exception ex)
            {
                Logging.LogText("Exception occured! ",ex, Logging.LogLevel.Error);
            }
        }
 protected override void OnStop()
 {
     myInstance.Dispose();
     myInstance = null;
 }
        private void cmdTestService_Click(object sender, RoutedEventArgs e)
        {
            lblError.Text = "";

            if (testinstance != null)
                testinstance.Dispose();

            string err = ProtokollerConfiguration.ActualConfigInstance.CheckConfiguration(false);
            if (err != null)
            {
                lblError.Text = err;
                return;
            }
            
            try
            {
                testinstance = new ProtokollerInstance(ProtokollerConfiguration.ActualConfigInstance);
                testinstance.ThreadExceptionOccured += new ThreadExceptionEventHandler(testinstance_ThreadExceptionOccured);
                testinstance.Start(false);
                cmdTestService.Background = Brushes.LightGreen;
                cmdTest.IsEnabled = false;
                cmdTestTriggers.IsEnabled = false;
                cmdTestWithStorrage.IsEnabled = false;
                cmbTriggerConnection.IsEnabled = false;
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }                        
        }
        private void cmdTestTriggers_Click(object sender, RoutedEventArgs e)
        {
            string err = ProtokollerConfiguration.ActualConfigInstance.CheckConfiguration(true);
            if (err != null)
            {
                lblError.Text = err;
                return;
            }

            try
            {
                using (myInstance = new ProtokollerInstance(ProtokollerConfiguration.ActualConfigInstance))
                {
                    myInstance.TestTriggers((DatasetConfig) cmbTriggerConnection.SelectedValue);
                }
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
                return;
            }
            lblError.Text = "OK!";

        }