/// <summary> /// Start application. /// Please see IN009005 and IN009034 for details. /// </summary> private static void StartApp() { if (GlobalFramework.PluginLicenceManager != null && (!Debugger.IsAttached || forceShowPluginLicenceWithDebugger)) { _log.Debug("void StartApp() :: Boot LogicPos after LicenceManager.IntellilockPlugin"); // Boot LogicPos after LicenceManager.IntellilockPlugin LicenseRouter licenseRouter = new LicenseRouter(); } else { bool dbExists = Utils.checkIfDbExists(); // Boot LogicPos without pass in LicenseRouter _log.Debug("void StartApp() :: Boot LogicPos without pass in LicenseRouter"); /* IN009005: creating a new thread for app start up */ System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(StartFrontOffice)); GlobalApp.DialogThreadNotify = new ThreadNotify(new ReadyEvent(Utils.ThreadDialogReadyEvent)); thread.Start(); /* Show "loading" */ _log.Debug("void StartApp() :: Show 'loading'"); GlobalApp.DialogThreadWork = Utils.GetThreadDialog(new Window("POS start up"), dbExists); GlobalApp.DialogThreadWork.Run(); /* IN009005: end */ } }
private void ActionRegister() { if (!GlobalFramework.PluginLicenceManager.ConnectToWS()) { Utils.ShowMessageTouch(this, DialogFlags.Modal, new System.Drawing.Size(600, 300), MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_license_ws_connection_error")); return; } if (GlobalFramework.PluginLicenceManager == null) { return; } byte[] registredLicence = new byte[0]; try { //Returns ByteWrite File registredLicence = GlobalFramework.PluginLicenceManager.ActivateLicense( _entryBoxName.EntryValidation.Text, _entryBoxCompany.EntryValidation.Text, _entryBoxFiscalNumber.EntryValidation.Text, _entryBoxAddress.EntryValidation.Text, _entryBoxEmail.EntryValidation.Text, _entryBoxPhone.EntryValidation.Text, _entryBoxHardwareId.EntryValidation.Text, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() ); string completeFilePath = string.Format("{0}{1}", LicenseRouter.GetCurrentDirectory(), GlobalFramework.PluginLicenceManager.GetLicenseFilename()); completeFilePath = completeFilePath.Replace("\\", "/"); //Used to generate diferent license file names per HardwareId : to Enable find "completeFilePath" //string completeFilePath = GetCurrentDirectory() + string.Format("logicpos_{0}.license", textBoxHardwareID.Text); if (!LicenseRouter.WriteByteArrayToFile(registredLicence, completeFilePath)) { Utils.ShowMessageTouch(this, DialogFlags.Modal, new System.Drawing.Size(600, 300), MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_license_ws_save_license_error")); return; } else { this.Destroy(); Utils.ShowMessageTouch(this, DialogFlags.Modal, new System.Drawing.Size(600, 300), MessageType.Info, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_information"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_license_aplication_registered")); this.Destroy(); Environment.Exit(0); } } catch (Exception ex) { _log.Error(ex.Message, ex); Utils.ShowMessageTouch(this, DialogFlags.Modal, new System.Drawing.Size(600, 300), MessageType.Error, ButtonsType.Close, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_license_ws_connection_timeout")); //Keep Running this.Run(); } }
public static void Main(string[] args) { try { // Show current Configuration File _log.Debug(String.Format("Use configuration file: [{0}]", System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); // Init Settings Main Config Settings GlobalFramework.Settings = ConfigurationManager.AppSettings; // BootStrap Paths InitPaths(); // Init PluginContainer GlobalFramework.PluginContainer = new PluginContainer(GlobalFramework.Path["plugins"].ToString()); // PluginSoftwareVendor GlobalFramework.PluginSoftwareVendor = (GlobalFramework.PluginContainer.GetFirstPluginOfType <ISoftwareVendor>()); if (GlobalFramework.PluginSoftwareVendor != null) { // Show Loaded Plugin _log.Debug(String.Format("Registered plugin: [{0}] Name : [{1}]", typeof(ISoftwareVendor), GlobalFramework.PluginSoftwareVendor.Name)); // Init Plugin SettingsApp.InitSoftwareVendorPluginSettings(); // Check if all Resources are Embedded GlobalFramework.PluginSoftwareVendor.ValidateEmbeddedResources(); } else { // Show Loaded Plugin _log.Error(String.Format("Error missing required plugin type Installed: [{0}]", typeof(ISoftwareVendor))); } // Try to Get LicenceManager IntellilockPlugin if in Release if (!Debugger.IsAttached || forceShowPluginLicenceWithDebugger) { GlobalFramework.PluginLicenceManager = (GlobalFramework.PluginContainer.GetFirstPluginOfType <ILicenceManager>()); // Show Loaded Plugin if (GlobalFramework.PluginLicenceManager != null) { _log.Debug(String.Format("Registered plugin: [{0}] Name : [{1}]", typeof(ILicenceManager), GlobalFramework.PluginLicenceManager.Name)); } } // Required before LicenseRouter Application.Init(); //Render GTK Theme : In Start to Style UI in BootStrap Dialogs Error Theme.ParseTheme(true, false); // Initialize LicenseRouter if IntellilockPlugin plugin is Registered in PluginContainer if (GlobalFramework.PluginLicenceManager != null && (!Debugger.IsAttached || forceShowPluginLicenceWithDebugger)) { // Boot LogicPos after LicenceManager.IntellilockPlugin LicenseRouter licenseRouter = new LicenseRouter(); } else { // Boot LogicPos without pass in LicenseRouter LogicPos logicPos = new LogicPos(); logicPos.StartApp(AppMode.FrontOffice); } } catch (Exception ex) { _log.Error(ex.Message, ex); } }