/// <summary>
 /// The reason this is here is to make sure that the
 /// monitor X/Y size matches with what is detected with the system
 /// saving the monitor x/y res and reloading it has caused confusion, causing users to
 /// have to remove, then re-add the indicated monitor
 /// </summary>
 private void CorrectMonitorConfig()
 {
     foreach (MonitorConfig mc in m_lstMonitorconfigs)
     {
         int xres = 0, yres = 0;
         if (DisplayManager.Instance().GetMonitorResoultion(mc.Monitorid, ref xres, ref yres))
         {
             mc.m_XDLPRes = xres;
             mc.m_YDLPRes = yres;
         }
     }
 }
 public bool SendProjCommand(string displayname, string commandname)
 {
     try
     {
         // get the projector command for 'on'
         // ACER_ON
         ProjectorCommand pcmd = UVDLPApp.Instance().m_proj_cmd_lst.FindByName(commandname);
         if (pcmd != null)
         {
             DeviceDriver dd = DisplayManager.Instance().FindDisplaySerialPortDriverByName(displayname);
             if (dd != null)
             {
                 if (dd.Connected)
                 {
                     byte[] data = pcmd.GetBytes();
                     dd.Write(data, data.Length);
                     return(true);
                 }
                 else
                 {
                     DebugLogger.Instance().LogError("Projector Driver not connected");
                 }
             }
             else
             {
                 DebugLogger.Instance().LogError("Projector Driver not found");
             }
         }
         else
         {
             DebugLogger.Instance().LogError("Projector command not found");
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex);
     }
     return(false);
 }
Example #3
0
        public void DoAppStartup()
        {
            m_dispmgr = DisplayManager.Instance();// initialze the displays
            m_apppath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            //get the path separater
            if (RunningPlatform() == Platform.Windows)
            {
                m_pathsep = "\\";
            }
            else
            {
                m_pathsep = "/";
            }
            // define some default paths
            m_PathMachines = m_apppath + m_pathsep + "Machines";  // use full paths - SHS
            m_PathProfiles = m_apppath + m_pathsep + "Profiles";

            // set up directories if they don't exist
            if (!Directory.Exists(m_PathMachines))
            {
                Utility.CreateDirectory(m_PathMachines);
            }
            if (!Directory.Exists(m_PathProfiles))
            {
                Utility.CreateDirectory(m_PathProfiles);
            }

            if (!m_appconfig.Load(m_apppath + m_pathsep + m_appconfigname))  // use full path - SHS
            {
                m_appconfig.CreateDefault();
                m_appconfig.Save(m_apppath + m_pathsep + m_appconfigname);  // use full path - SHS
            }
            // this will check and make sure the default machines have been created
            CheckAndCreateDefaultMachines();
            //load the current machine configuration file
            if (!m_printerinfo.Load(m_appconfig.m_curmachineeprofilename))
            {
                // m_printerinfo.Save(m_appconfig.m_curmachineeprofilename);
                DebugLogger.Instance().LogError("Cannot Load Machine Profile " + m_appconfig.m_curmachineeprofilename);
            }
            // machine configuration was just loaded here.
            RaiseAppEvent(eAppEvent.eMachineTypeChanged, ""); // notify the gui to set up correctly
            //load the projector command list

            if (!LoadProjectorCommands(m_appconfig.ProjectorCommandsFile))
            {
                SaveProjectorCommands(m_appconfig.ProjectorCommandsFile);
            }
            //load the current slicing profile
            if (!m_buildparms.Load(m_appconfig.m_cursliceprofilename))
            {
                m_buildparms.CreateDefault();
                m_buildparms.Save(m_appconfig.m_cursliceprofilename);
            }
            // set up the drivers
            SetupDriver();
            //SetupDriverProjector();
            // load the support configuration
            if (!LoadSupportConfig(m_appconfig.SupportConfigName))
            {
                SaveSupportConfig(m_appconfig.SupportConfigName);
            }
            //load the license keys
            LoadLicenseKeys();
            //look for plug-ins and validate licensing
            ScanForPlugins();
            // validate those loaded plugins against license keys
            CheckLicensing();
            // initialize the plugins, the main form will send a secondary init after the main app gui is created
            PerformPluginCommand("InitCommand", true);
            m_sc = new ServerContact();
            m_sc.ServerContactEvenet += new ServerContact.Servercontacted(m_sc_ServerContactEvent);
            m_sc.UpdateRegInfo();
            m_undoer.RegisterCallback();
        }
Example #4
0
        public void DoAppStartup()
        {
            m_dispmgr = DisplayManager.Instance();// initialze the displays
            m_apppath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            //get the path separater
            if (RunningPlatform() == Platform.Windows)
            {
                m_pathsep = "\\";
            }
            else
            {
                m_pathsep = "/";
            }
            // define some default paths
            m_PathMachines = m_apppath + m_pathsep + "Machines";  // use full paths - SHS
            m_PathProfiles = m_apppath + m_pathsep + "Profiles";

            // set up directories if they don't exist
            if (!Directory.Exists(m_PathMachines))
            {
                Utility.CreateDirectory(m_PathMachines);
            }
            if (!Directory.Exists(m_PathProfiles))
            {
                Utility.CreateDirectory(m_PathProfiles);
            }

            if (!m_appconfig.Load(m_apppath + m_pathsep + m_appconfigname))  // use full path - SHS
            {
                m_appconfig.CreateDefault();
                m_appconfig.Save(m_apppath + m_pathsep + m_appconfigname);  // use full path - SHS
            }
            // this will check and make sure the default machines have been created
            CheckAndCreateDefaultMachines();
            //load the current machine configuration file
            if (!m_printerinfo.Load(m_appconfig.m_curmachineeprofilename))
            {
                // m_printerinfo.Save(m_appconfig.m_curmachineeprofilename);
                DebugLogger.Instance().LogError("Cannot Load Machine Profile " + m_appconfig.m_curmachineeprofilename);
            }
            // machine configuration was just loaded here.
            RaiseAppEvent(eAppEvent.eMachineTypeChanged, ""); // notify the gui to set up correctly
            //load the projector command list

            if (!LoadProjectorCommands(m_appconfig.ProjectorCommandsFile))
            {
                SaveProjectorCommands(m_appconfig.ProjectorCommandsFile);
            }
            //load the current slicing profile
            if (!m_buildparms.Load(m_appconfig.m_cursliceprofilename))
            {
                m_buildparms.CreateDefault();
                m_buildparms.Save(m_appconfig.m_cursliceprofilename);
            }
            else
            {
                m_buildparms.CreateDefault();
                m_buildparms.Load(m_appconfig.m_cursliceprofilename);
            }
            // set up the drivers
            SetupDriver();
            //SetupDriverProjector();
            // load the support configuration
            if (!LoadSupportConfig(m_appconfig.SupportConfigName))
            {
                SaveSupportConfig(m_appconfig.SupportConfigName);
            }
            //load the license keys
            LoadLicenseKeys();
            //look for plug-ins and validate licensing
            ScanForPlugins();
            //look for 'lite' plugins
            ScanForPluginsLite();
            // validate those loaded plugins against license keys
            CheckLicensing();
            // initialize the plugins, the main form will send a secondary init after the main app gui is created
            PerformPluginCommand("InitCommand", true);
            m_sc = new ServerContact();
            m_sc.ServerContactEvenet += new ServerContact.Servercontacted(m_sc_ServerContactEvent);

            //contacting Server twise?? commenting this out for now
            //m_sc.UpdateRegInfo();
            m_undoer.RegisterCallback();
            // pack all 2d gl images
            //m_2d_graphics.GenereteUserTexture();


            //load Rsource files

            //this is not good way to load resource files. but the problem is visual studio cant generate auto-generation code for names with dot "."

            resman = new ResourceManager("UV_DLP_3D_Printer.Resource.en", typeof(UVDLPApp).Assembly);
            cul    = CultureInfo.CreateSpecificCulture("");

            if (UVDLPApp.Instance().m_appconfig.m_Selected_Language == "es")
            {
                resman = new ResourceManager("UV_DLP_3D_Printer.Resource.es", typeof(UVDLPApp).Assembly);
                cul    = CultureInfo.CreateSpecificCulture("");
            }
            else if (UVDLPApp.Instance().m_appconfig.m_Selected_Language == "en")
            {
                resman = new ResourceManager("UV_DLP_3D_Printer.Resource.en", typeof(UVDLPApp).Assembly);
                cul    = CultureInfo.CreateSpecificCulture("");
            }
            else
            {
                resman = new ResourceManager("UV_DLP_3D_Printer.Resource.en", typeof(UVDLPApp).Assembly);
                cul    = CultureInfo.CreateSpecificCulture("");
            }
        }