Beispiel #1
0
        public static void StartProgram()
        {
            //Load the default lighting config.  If the directory does not exist, create it.
            if (!Directory.Exists(Utilities.PROGRAM_FILES_PATH))
            {
                Directory.CreateDirectory(Utilities.PROGRAM_FILES_PATH);
            }
            //If the file does not exist, create it.
            if (!File.Exists(Utilities.PROGRAM_FILES_PATH + "\\Default.lsc"))
            {
                FileStream f = File.Create(Utilities.PROGRAM_FILES_PATH + "\\Default.lsc");
                f.Close();
            }
            Stream inputStream = File.OpenRead(Utilities.PROGRAM_FILES_PATH + "\\Default.lsc");

            try
            {
                //Attempt to deserialize from the lighting config file.
                BinaryFormatter deserializer = new BinaryFormatter();
                _lightingSystemConfiguration = (LightingSystemConfiguration)deserializer.Deserialize(inputStream);
            }
            catch (System.Runtime.Serialization.SerializationException e)
            {
                MessageBox.Show("The default configuration file could not be found.  The system will create a new one.");
            }
            catch (Exception e)
            {
                Utilities.ReportError(e);
            }
            finally
            {
                inputStream.Close();
            }

            //Start DMX
            DMXController.StartDMX();

            //Start other static classes
            Total_DMX_Control_WPF.Fixtures.Start();

            ////Connect to iTunes Jukebox Server
            //if (Properties.Settings.Default.EnableItunesJukeboxSupport)
            //{
            //    _lightingCommunication.ConnectToServer(Properties.Settings.Default.ItunesJukeboxServerIdentifier,
            //        Properties.Settings.Default.ItunesJukeboxPort,
            //        "Total DMX Control", ClientType.LIGHTING, new Version());
            //}
            //DMXController.SetLevel("START", 62, 255);
            //DMXController.SetLevel("START", 63, 255);
            WindowManager.ShowMainWindow();
        }