예제 #1
0
        public Scii()
        {
            _lcdDisplay = new CharDisplay();

            PrintScreen("Schedulon II", "by Technomad LLC");
            Thread.Sleep(1000);
            PrintScreen("Audio.", "       Anywhere.");
            Thread.Sleep(1000);
            _lcdDisplay.Clear();
            PrintScreen("Schedulon II");

            Log.LogFileName = Settings.FileSystem.RootDir + Settings.FileSystem.SystemDir + @"log\logfile.txt";
            Log.InsertBlankLine();
            Log.WriteString(LogMessageType.Info, "Application start");

            IRotaryEncoder rotaryEncoder = new RotaryEncoder();
            IAudioRecordPlayer audioplayer = new AudioPlayer();

            var audioCore = new AudioCore(audioplayer);
            audioCore.NowPlaying += OnNowPlaying;
            audioCore.NowRecording += OnNowRecording;

            var lcm = new LocalControlModule(_lcdDisplay, rotaryEncoder, audioCore);
            var schedulingCore = new SchedulingCore(audioCore, _lcdDisplay, lcm);

            var knobSet = new KnobSet(rotaryEncoder, _lcdDisplay, audioCore, schedulingCore, lcm);

            var fileCore = new FileCore();

            try
            {
                Settings.Load();
            }
            catch (Exception e)
            {
                Log.WriteException(e, "Error loading system settings. System locked");
                PrintScreen("System halted", "Settings error");
                Thread.Sleep(Timeout.Infinite);
            }

            if (Settings.Web.UseLlmnr)
            {
                _llmnr = new LinkLocalMultiCastNameResolution("Schedulon");
                _llmnr.Start(IPAddress.Parse("10.0.0.110"));
            }

            var webServer = new WebServer(schedulingCore, knobSet, audioCore, fileCore);

            var webserverThread = new Thread(webServer.Run);
            webserverThread.Start();
        }