Exemplo n.º 1
0
        public void AutoOpen()
        {
            try
            {
                AddinContext.ConfigManager = new ConfigurationManagerWrapper();

                // Settings the path to the Add-In
                AddinContext.Settings.AddinPath = (string)XlCall.Excel(XlCall.xlGetName);

                // Token cancellation is useful to close all existing Tasks<> before leaving the application
                AddinContext.TokenCancellationSource = new CancellationTokenSource();

                // The Excel Application object
                AddinContext.ExcelApp = new Application(null, ExcelDnaUtil.Application);

                // Start the bootstrapper now
                new Bootstrapper(AddinContext.TokenCancellationSource.Token).Start();
            }
            catch (Exception e)
            {
                LogDisplay.RecordLine(e.Message);
                LogDisplay.RecordLine(e.StackTrace);
                LogDisplay.Show();
            }
        }
Exemplo n.º 2
0
        public ActionResult Reload(string levelSelect,
                                   string StartTime,
                                   string EndTime,
                                   string ThreadId,
                                   string numberOfItems,
                                   string searchType,
                                   string Search)
        {
            string fileSelected;
            string filePattern;
            char   fileSeparator;

            LogParserFilter filter = LoadParameters.CreateFilter(levelSelect, StartTime,
                                                                 EndTime, ThreadId,
                                                                 numberOfItems, searchType,
                                                                 Search, false);

            parserContent = new LogDisplay();

            fileSelected  = (string)Session["fileSelected"];
            filePattern   = (string)Session["filePattern"];
            fileSeparator = (char)Session["fileSeparator"];

            parserContent.Parsing10MBLogFile(filter, fileSelected, filePattern, fileSeparator);

            parserContent = LocalSearchFilter.Filter(parserContent, null, null, searchType, Search);

            Session["parserContent"] = parserContent;

            return(RedirectToAction("Display"));
        }
Exemplo n.º 3
0
        public ActionResult DisplayLog()
        {
            parserContent = (LogDisplay)Session["parserContent"];

            LogParserFilter filter;

            if (Session["filter"] != null)
            {
                filter = (LogParserFilter)Session["filter"];
            }
            else
            {
                filter = new LogParserFilter();
                filter.FilterNumberOfLogItems = searchNumberOfItems;
            }

            if (parserContent == null)
            {
                parserContent = new LogDisplay();
                parserContent.Parsing10MBLogFile(null, null, null, null);
            }

            ViewData["Id"]      = Session["Id"];
            ViewData["Content"] = parserContent;
            ViewData["filter"]  = filter;
            ViewData["numberOfItemsPerPage"] = numberOfItemsPerPage;
            ViewData["matchWholeWordFilter"] = Session["matchWholeWordFilter"];
            ViewData["searchContent"]        = Session["searchContent"];
            Session["parserContent"]         = parserContent;

            return(View());
        }
Exemplo n.º 4
0
        public void GetLogFiles()
        {
            LogDisplay parserContent = new LogDisplay();

            Dictionary <string, string> logFiles = new Dictionary <string, string>();

            XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();

            xmlReaderSettings.IgnoreComments = true;
            xmlReaderSettings.IgnoreProcessingInstructions = true;
            xmlReaderSettings.IgnoreWhitespace             = true;

            using (XmlReader xmlReader = XmlReader.Create(System.IO.File.OpenRead(@"\\zarja\share\Marko\LogConfig.xml"), xmlReaderSettings))
            {
                string key;

                while (false == xmlReader.EOF)
                {
                    xmlReader.Read();

                    if (xmlReader.Name == "LogURL" && xmlReader.NodeType != XmlNodeType.EndElement)
                    {
                        key = xmlReader["logKey"];

                        xmlReader.Read();

                        logFiles.Add(key, xmlReader.Value);
                    }
                }
            }

            ViewData["LogFiles"] = logFiles;
        }
Exemplo n.º 5
0
 public void ShowMessage()
 {
     logger.Debug("Inside show message method");
     LogDisplay.Clear();
     LogDisplay.WriteLine("Button Clicked");
     LogDisplay.Show();
 }
Exemplo n.º 6
0
        private object ErrorHandler(object exceptionObject)
        {
            if (exceptionObject != null)
            {
                LogDisplay.WriteLine("Exception: " + exceptionObject.ToString());
            }

            // return #VALUE into the cell.
            return(ExcelError.ExcelErrorValue);
        }
Exemplo n.º 7
0
 private void RepaintLogs(object sender, EventArgs e)
 {
     lock (LockLog)
     {
         LogDisplay.Invoke(new MethodInvoker(delegate
         {
             LogDisplay.Text += LogWriter.GetInstance().Logs.Last() + Environment.NewLine;
         }));
     }
 }
Exemplo n.º 8
0
 public KioskHandler(LogDisplay logger)
 {
     _Logger     = logger;
     _clsUsbComm = new KioskComm();
     _clsUsbComm.TransactionComplateArrived += _clsUsbCom_TransactionComplateArrived;
     _clsUsbComm.CommandReceive             += _clsUsbCom_CommandReceive;
     _clsUsbComm.CommandSend        += _clsUsbCom_CommandSend;
     _clsUsbComm.ReaderMessageEvent += _clsUsbCom_ReaderMessageEvent;
     _clsUsbComm.ErrorMessage       += _clsUsbComm_ErrorMessage;
 }
Exemplo n.º 9
0
 public void ClearLogDisplayButton_OnAction(IRibbonControl control)
 {
     try
     {
         LogDisplay.Clear();
     }
     catch (Exception ex)
     {
         ProcessUnhandledException(ex);
     }
 }
Exemplo n.º 10
0
 public static void LoadForm()
 {
     try
     {
         _windowStarter.ShowSingeltonWindow <MainWindow, MainWindowViewModel>();
     }
     catch (Exception ex)
     {
         LogDisplay.WriteLine(ex.ToString());
     }
 }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     if (main == null)
     {
         main = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
 internal static void InitializeRDotNet()
 {
     try
     {
         REngine.SetEnvironmentVariables();
         _engine = REngine.GetInstance();
         _engine.Initialize();
     }
     catch (Exception ex)
     {
         LogDisplay.WriteLine("Error initializing RDotNet: " + ex.Message);
     }
 }
Exemplo n.º 13
0
        public void Emit(LogEvent logEvent)
        {
            EnsureNotDisposed();

            var stringWriter = new StringWriter(new StringBuilder(256));

            _formatter.Format(logEvent, stringWriter);

            lock (_syncRoot)
            {
                LogDisplay.DisplayOrder = _displayOrder;
                LogDisplay.RecordLine(stringWriter.ToString());
            }
        }
Exemplo n.º 14
0
        private object ErrorHandler(object exceptionObject)
        {
            ExcelReference caller = (ExcelReference)XlCall.Excel(XlCall.xlfCaller);

            // Calling reftext here requires all functions to be marked IsMacroType=true, which is undesirable.
            // A better plan would be to build the reference text oneself, using the RowFirst / ColumnFirst info
            // Not sure where to find the SheetName then....
            string callingName = (string)XlCall.Excel(XlCall.xlfReftext, caller, true);

            LogDisplay.WriteLine(callingName + " Error: " + exceptionObject.ToString());

            // return #VALUE into the cell anyway.
            return(ExcelError.ExcelErrorValue);
        }
Exemplo n.º 15
0
 public void AutoOpen()
 {
     try
     {
         // The Excel Application object
         AddinContext.ExcelApp = new Application(null, ExcelDnaUtil.Application);
     }
     catch (Exception e)
     {
         LogDisplay.RecordLine(e.Message);
         LogDisplay.RecordLine(e.StackTrace);
         LogDisplay.Show();
     }
 }
Exemplo n.º 16
0
        private static ACQ.Math.Interpolation.ScatteredInterpolationInterface construct_interpolator(double[,] x, double[] y, object input_scales, object method)
        {
            ACQ.Math.Interpolation.ScatteredInterpolationInterface interpolator = null;
            try
            {
                ACQ.Math.Interpolation.enRadialBasisFunction rbf_function = ExcelHelper.CheckEnum <ACQ.Math.Interpolation.enRadialBasisFunction>(method, ACQ.Math.Interpolation.enRadialBasisFunction.Linear);

                double[] scales = null; //null argument is ok

                if (!(input_scales is ExcelMissing) && input_scales != null)
                {
                    if (input_scales is double)
                    {
                        double const_scale = (double)input_scales;
                        scales = new double[x.GetLength(1)];

                        for (int i = 0; i < scales.Length; i++)
                        {
                            scales[i] = const_scale;
                        }
                    }
                    else if (input_scales is object[])
                    {
                        object[] vect_scale = input_scales as object[];
                        scales = new double[x.GetLength(1)];

                        for (int i = 0; i < scales.Length; i++)
                        {
                            if (i < vect_scale.Length && vect_scale[i] is double)
                            {
                                scales[i] = (double)vect_scale[i];
                            }
                            else
                            {
                                scales[i] = 1.0;
                            }
                        }
                    }
                }

                interpolator = new ACQ.Math.Interpolation.RbfInterpolation(x, y, rbf_function, scales, 0.0);
            }
            catch (Exception ex)
            {
                LogDisplay.WriteLine("Error: " + ex.ToString());
            }
            return(interpolator);
        }
Exemplo n.º 17
0
        public void AutoOpen()
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .Enrich.WithXllPath()
                         .Enrich.WithExcelVersion()
                         .Enrich.WithExcelVersionName()
                         .Enrich.WithExcelBitness()
                         .WriteTo.ExcelDnaLogDisplay(displayOrder: DisplayOrder.NewestFirst,
                                                     outputTemplate: "{Properties:j}{NewLine}[{Level:u3}] {Message:lj}{NewLine}{Exception}")
                         .CreateLogger();

            Log.Information("Hello from {AddInName}! :)", DnaLibrary.CurrentLibrary.Name);
            LogDisplay.Show();

            ExcelComAddInHelper.LoadComAddIn(this);
        }
        public void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            if (_clearLogOnDispose)
            {
                lock (_syncRoot)
                {
                    LogDisplay.Clear();
                }
            }

            _disposed = true;
        }
        private static LiborRates construct_LiborCurve(double[] curva)
        {
            LiborRates LiborRate_Array = null;

            try
            {
                LiborRate_Array = new LiborRates(curva);
            }
            catch (Exception ex)
            {
                lock (m_sync)
                {
                    LogDisplay.WriteLine("Error: " + ex.ToString());
                }
            }

            return(LiborRate_Array);
        }
Exemplo n.º 20
0
        private static ACQ.Math.Interpolation.InterpolationInterface2D construct_interpolator(double[] x1, double[] x2, double[,] y, object method)
        {
            ACQ.Math.Interpolation.InterpolationInterface2D interpolator = null;
            try
            {
                string interpolation_method = ExcelHelper.Check(method, m_defaultInterpolator);

                interpolator = ACQ.Math.Interpolation.InterpolationFactory2D.GetInterpolator(interpolation_method, x1, x2, y);
            }
            catch (Exception ex)
            {
                lock (m_sync)
                {
                    LogDisplay.WriteLine("Error: " + ex.ToString());
                }
            }
            return(interpolator);
        }
Exemplo n.º 21
0
        public void AutoOpen()
        {
            var configFileName = "AddInReloaderConfiguration.xml";
            var xllDirectory   = Path.GetDirectoryName(ExcelDnaUtil.XllPath);
            var configPath     = Path.Combine(xllDirectory, configFileName);

            try
            {
                // Load config
                XmlSerializer configLoader        = new XmlSerializer(typeof(AddInReloaderConfiguration));
                AddInReloaderConfiguration config = (AddInReloaderConfiguration)configLoader.Deserialize(File.OpenRead(configPath));
                _watcher = new AddInWatcher(config);
            }
            catch (Exception ex)
            {
                LogDisplay.WriteLine("AddInReloader - Error loading the configuration file: " + ex.ToString());
            }
        }
Exemplo n.º 22
0
        public void AutoOpen()
        {
            try
            {
                // Token cancellation is useful to close all existing Tasks<> before leaving the application
                AddinContext.TokenCancellationSource = new CancellationTokenSource();

                AddinContext.ExcelApp = new Xl.Application(null, ExcelDnaUtil.Application);

                // Start the bootstrapper now
                new Bootstrapper(AddinContext.TokenCancellationSource.Token).Start();
            }
            catch (Exception e)
            {
                LogDisplay.RecordLine(e.Message);
                LogDisplay.RecordLine(e.StackTrace);
                LogDisplay.Show();
            }
        }
Exemplo n.º 23
0
        private static ACQ.Math.Interpolation.InterpolationInterface construct_interpolator(double[] x, double[] y, object method, object bounds)
        {
            ACQ.Math.Interpolation.InterpolationInterface interpolator = null;
            try
            {
                string interpolation_method = ExcelHelper.Check(method, m_defaultInterpolator);
                bool   interpolation_bounds = ExcelHelper.CheckValue(bounds, true);

                interpolator        = ACQ.Math.Interpolation.InterpolationFactory.GetInterpolator(interpolation_method, x, y);
                interpolator.Bounds = interpolation_bounds;
            }
            catch (Exception ex)
            {
                lock (m_sync)
                {
                    LogDisplay.WriteLine("Error: " + ex.ToString());
                }
            }
            return(interpolator);
        }
Exemplo n.º 24
0
        private static ACQ.Math.Regression.Lowess construct_lowess(double[] x, double[] y, object span, object nsteps, object delta)
        {
            ACQ.Math.Regression.Lowess lowess = null;
            try
            {
                double span_input   = ExcelHelper.CheckValue <double>(span, 2.0 / 3.0);
                double delta_input  = ExcelHelper.CheckValue <double>(delta, 0.0); //set to zero so that lowess will pick default based on data range
                int    nsteps_input = (int)ExcelHelper.CheckValue <double>(nsteps, 3);

                lowess = new Math.Regression.Lowess(x, y, span_input, nsteps_input, delta_input);
            }
            catch (Exception ex)
            {
                lock (m_sync)
                {
                    LogDisplay.WriteLine("Error: " + ex.ToString());
                }
            }
            return(lowess);
        }
Exemplo n.º 25
0
        public async Task Insert(DbInsertContext context, LogDisplay l)
        {
            var redirection = new TestPageRedirection()
            {
                TestName      = context.TestName,
                IndexInTest   = context.IndexInTest,
                UserName      = context.UserName,
                ScenarioNames = context.ScenarioNames,
                FromPageName  = null,
                MemberName    = null,
                ToPageName    = l.PageQuery.GetType().GetFriendlyName(),
                IsForm        = false,
                IsLink        = false
            };

            await repository.InsertAsync(redirection);

            context.IndexInTest++;

            await InsertPage(context, l.PageQuery, redirection);
        }
Exemplo n.º 26
0
        public static object acq_regression_linear_create(
            [ExcelArgument(Description = "x")] double[,] x,
            [ExcelArgument(Description = "y")]  double[] y,
            [ExcelArgument(Description = "Intercept, optional(default=true)")]  object intercept,
            [ExcelArgument(Description = "Weights, optional(default = none)")]  object weights)
        {
            if (ExcelDnaUtil.IsInFunctionWizard())
            {
                return(ExcelError.ExcelErrorRef);
            }
            else
            {
                bool     include_intercept = ExcelHelper.CheckValue(intercept, true);
                double[] reg_weights       = ExcelHelper.CheckArray <double>(weights);

                return(ACQ.Excel.Handles.GlobalCache.CreateHandle(m_tag, new object[] { x, y, reg_weights, include_intercept, "acq_regression_linear_create" },
                                                                  (objectType, parameters) =>
                {
                    ACQ.Math.Regression.LinearRegression regression = null;

                    try
                    {
                        regression = new Math.Regression.LinearRegression(x, y, reg_weights, include_intercept);
                    }
                    catch (Exception ex)
                    {
                        LogDisplay.WriteLine("Error: " + ex.ToString());
                    }

                    if (regression == null)
                    {
                        return ExcelError.ExcelErrorNull;
                    }
                    else
                    {
                        return regression;
                    }
                }));
            }
        }
Exemplo n.º 27
0
        private static IMortgageLoan construct_loan(double Balance, double Rate, double Spread, int Maturity, int Resetting, string FixedOrARM, string PIOrIO, string Libor_Name)
        {
            LiborRates LiborRate;

            GlobalCache.TryGetObject <LiborRates>(Libor_Name, out LiborRate);

            IMortgageLoan loan = null;

            try
            {
                // Build the loan
                IRepayment rmPI = RepaymentFactory.GetRep(PIOrIO);
                loan = MortgageLoanFactory.GetLoan(FixedOrARM, Balance, Maturity, Rate, Resetting, Spread, LiborRate, rmPI);
            }
            catch (Exception ex)
            {
                lock (m_sync)
                {
                    LogDisplay.WriteLine("Error: " + ex.ToString());
                }
            }
            return(loan);
        }
Exemplo n.º 28
0
 public void Error_Click(IRibbonControl control_)
 {
     LogDisplay.Show();
 }
Exemplo n.º 29
0
        internal List <ExportedAssembly> GetAssemblies(string pathResolveRoot, DnaLibrary dnaLibrary)
        {
            List <ExportedAssembly> list = new List <ExportedAssembly>();

            try
            {
                string realPath = Path;
                if (Path.StartsWith("packed:"))
                {
                    // The ExternalLibrary is packed.
                    // We'll have to load it from resources.
                    string resourceName = Path.Substring(7);
                    if (Path.EndsWith(".DNA", StringComparison.OrdinalIgnoreCase))
                    {
                        byte[]     dnaContent = ExcelIntegration.GetDnaFileBytes(resourceName);
                        DnaLibrary lib        = DnaLibrary.LoadFrom(dnaContent, pathResolveRoot);
                        if (lib == null)
                        {
                            LogDisplay.WriteLine("External library could not be registered - Path: " + Path);
                            LogDisplay.WriteLine("    Error: Packed DnaLibrary could not be loaded.");
                            return(list);
                        }

                        return(lib.GetAssemblies(pathResolveRoot));
                    }
                    else
                    {
                        // DOCUMENT: TypeLibPath which is a resource in a library is denoted as fileName.dll\4
                        // For packed assemblies, we set TypeLibPath="packed:2"
                        string typeLibPath = null;
                        if (!string.IsNullOrEmpty(TypeLibPath) && TypeLibPath.StartsWith("packed:"))
                        {
                            typeLibPath = DnaLibrary.XllPath + @"\" + TypeLibPath.Substring(7);
                        }

                        // It would be nice to check here whether the assembly is loaded already.
                        // But because of the name mangling in the packing we can't easily check.

                        // So we make the following assumptions:
                        // 1. Packed assemblies won't also be loadable from files (else they might be loaded twice)
                        // 2. ExternalLibrary loads will happen before reference loads via AssemblyResolve.
                        // Under these assumptions we should not have assemblies loaded more than once,
                        // even if not checking here.
                        byte[]   rawAssembly = ExcelIntegration.GetAssemblyBytes(resourceName);
                        Assembly assembly    = Assembly.Load(rawAssembly);
                        list.Add(new ExportedAssembly(assembly, ExplicitExports, ExplicitRegistration, ComServer, false, typeLibPath, dnaLibrary));
                        return(list);
                    }
                }
                if (Uri.IsWellFormedUriString(Path, UriKind.Absolute))
                {
                    // Here is support for loading ExternalLibraries from http.
                    Uri uri = new Uri(Path, UriKind.Absolute);
                    if (uri.IsUnc)
                    {
                        realPath = uri.LocalPath;
                        // Will continue to load later with the regular file load part below...
                    }
                    else
                    {
                        string scheme = uri.Scheme.ToLowerInvariant();
                        if (scheme != "http" && scheme != "file" && scheme != "https")
                        {
                            Logging.LogDisplay.WriteLine("The ExternalLibrary path {0} is not a valid Uri scheme.", Path);
                            return(list);
                        }
                        else
                        {
                            if (uri.AbsolutePath.EndsWith("dna", StringComparison.InvariantCultureIgnoreCase))
                            {
                                DnaLibrary lib = DnaLibrary.LoadFrom(uri);
                                if (lib == null)
                                {
                                    LogDisplay.WriteLine("External library could not be registered - Path: " + Path);
                                    LogDisplay.WriteLine("    Error: DnaLibrary could not be loaded.");
                                    return(list);
                                }
                                // CONSIDER: Should we add a resolve story for .dna files at Uris?
                                return(lib.GetAssemblies(null)); // No explicit resolve path
                            }
                            else
                            {
                                // Load as a regular assembly - TypeLib not supported.
                                Assembly assembly = Assembly.LoadFrom(Path);
                                list.Add(new ExportedAssembly(assembly, ExplicitExports, ExplicitRegistration, ComServer, false, null, dnaLibrary));
                                return(list);
                            }
                        }
                    }
                }
                // Keep trying with the current value of realPath.
                string resolvedPath = DnaLibrary.ResolvePath(realPath, pathResolveRoot);
                if (resolvedPath == null)
                {
                    LogDisplay.WriteLine("External library could not be registered - Path: " + Path);
                    LogDisplay.WriteLine("    Error: The library could not be found at this location.");
                    return(list);
                }
                if (System.IO.Path.GetExtension(resolvedPath).Equals(".DNA", StringComparison.OrdinalIgnoreCase))
                {
                    // Load as a DnaLibrary
                    DnaLibrary lib = DnaLibrary.LoadFrom(resolvedPath);
                    if (lib == null)
                    {
                        LogDisplay.WriteLine("External library could not be registered - Path: " + Path);
                        LogDisplay.WriteLine("    Error: DnaLibrary could not be loaded.");
                        return(list);
                    }

                    string pathResolveRelative = System.IO.Path.GetDirectoryName(resolvedPath);
                    return(lib.GetAssemblies(pathResolveRelative));
                }
                else
                {
                    Assembly assembly;
                    // Load as a regular assembly
                    // First check if it is already loaded (e.g. as a reference from another assembly)
                    // DOCUMENT: Some cases might still have assemblies loaded more than once.
                    // E.g. for an assembly that is both ExternalLibrary and references from another assembly,
                    // having the assembly LoadFromBytes and in the file system would load it twice,
                    // because LoadFromBytes here happens before the .NET loaders assembly resolution.
                    string assemblyName = System.IO.Path.GetFileNameWithoutExtension(resolvedPath);
                    assembly = GetAssemblyIfLoaded(assemblyName);
                    if (assembly == null)
                    {
                        // Really have to load it.
                        if (LoadFromBytes)
                        {
                            // We need to be careful here to not re-load the assembly if it had already been loaded,
                            // e.g. as a dependency of an assembly loaded earlier.
                            // In that case we won't be able to have the library 'LoadFromBytes'.
                            byte[] bytes = File.ReadAllBytes(resolvedPath);

                            string pdbPath = System.IO.Path.ChangeExtension(resolvedPath, "pdb");
                            if (File.Exists(pdbPath))
                            {
                                byte[] pdbBytes = File.ReadAllBytes(pdbPath);
                                assembly = Assembly.Load(bytes, pdbBytes);
                            }
                            else
                            {
                                assembly = Assembly.Load(bytes);
                            }
                        }
                        else
                        {
                            assembly = Assembly.LoadFrom(resolvedPath);
                        }
                    }
                    string resolvedTypeLibPath = null;
                    if (!string.IsNullOrEmpty(TypeLibPath))
                    {
                        resolvedTypeLibPath = DnaLibrary.ResolvePath(TypeLibPath, pathResolveRoot); // null is unresolved
                        if (resolvedTypeLibPath == null)
                        {
                            resolvedTypeLibPath = DnaLibrary.ResolvePath(TypeLibPath, System.IO.Path.GetDirectoryName(resolvedPath));
                        }
                    }
                    else
                    {
                        // Check for .tlb with same name next to resolvedPath
                        string tlbCheck = System.IO.Path.ChangeExtension(resolvedPath, "tlb");
                        if (System.IO.File.Exists(tlbCheck))
                        {
                            resolvedTypeLibPath = tlbCheck;
                        }
                    }
                    list.Add(new ExportedAssembly(assembly, ExplicitExports, ExplicitRegistration, ComServer, false, resolvedTypeLibPath, dnaLibrary));
                    return(list);
                }
            }
            catch (Exception e)
            {
                // Assembly could not be loaded.
                LogDisplay.WriteLine("External library could not be registered - Path: " + Path);
                LogDisplay.WriteLine("    Error: " + e.Message);
                return(list);
            }
        }
Exemplo n.º 30
0
    public static void  Main(string[] args)
    {
        // Assemble your system here from all the classes
        Door           _door           = new Door();
        RFIDReader     _rfid           = new RFIDReader();
        PrintToDisplay _printToDisplay = new PrintToDisplay();
        Display        _display        = new Display(_printToDisplay);
        LogDisplay     _logDisplay     = new LogDisplay();
        Log            _log            = new Log(_logDisplay);
        UsbCharger     _charger        = new UsbCharger();
        ChargeControl  _chargeControl  = new ChargeControl(_display, _charger);
        StationControl _stationControl = new StationControl(_chargeControl, _door, _display, _rfid, _log);

        bool   finish = false;
        string input;

        System.Console.WriteLine(" -----------------------------------------\n\n " +
                                 " INDTAST FOR AT FORTAGE EN HANDLING\n " +
                                 "  E (Exit)\n " +
                                 "  O (Open)\n " +
                                 "  C (Closed)\n " +
                                 "  R (Read RFID)\n " +
                                 "  G (Guide)\n\n" +
                                 "-----------------------------------------");


        do
        {
            input = Console.ReadLine();
            if (string.IsNullOrEmpty(input))
            {
                continue;
            }

            switch (input[0])
            {
            case 'E':
            case 'e':
                finish = true;
                break;

            case 'O':
            case 'o':
                _door.DoorOpen();
                break;

            case 'C':
            case 'c':
                _door.DoorClosed();
                break;

            case 'R':
            case 'r':
                System.Console.WriteLine("Indtast RFID id: ");
                string idString = System.Console.ReadLine();

                int id = Convert.ToInt32(idString);
                if (id > 0)
                {
                    _rfid.OnRfidRead(id);
                }
                else
                {
                    System.Console.WriteLine("RFID er ugyldigt! RFID kan ikke være et negativt tal eller over 10.000!");
                }

                break;

            case 'G':
            case 'g':
                System.Console.WriteLine(" -----------------------------------------\n\n " +
                                         " 1. Open the door of the Ladeskab\n " +
                                         " 2. Insert your phone into the Ladeskab\n " +
                                         " 3. Connect your phone to the USB charger inside the Ladeskab\n " +
                                         " 4. CLose the door of the Ladeskab\n " +
                                         " 5. Read your RFID tag on the RFID-Reader\n " +
                                         " !!Congratulations! Your phone is now charging!!\n\n" +
                                         " Note: To remove your phone from the Ladeskab read your RFID tag on the RFID Reader and open the door to the Ladeskab\n\n" +
                                         "-----------------------------------------");
                break;

            default:
                break;
            }
        } while (!finish); //test af push
    }