Beispiel #1
0
        public static void Main(string[] args)
        {
            try
            {
                // Show current Configuration File
                _log.Debug(String.Format("Use configuration file: [{0}]", System.AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));

                /* IN009203 - Mutex block */
                using (_SingleProgramInstance)
                {
                    // Init Settings Main Config Settings
                    GlobalFramework.Settings = ConfigurationManager.AppSettings;

                    //IN009296 BackOffice - Mudar o idioma da aplicação
                    SetCulture();

                    // 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);

                    /* IN009203 - prevent lauching multiple instances of application */
                    if (_SingleProgramInstance.IsSingleInstance)
                    {/* No app instance is running, start it */
                        /* IN009034 */
                        StartApp();
                    }
                    else
                    {     /* App already running, show info to user and ends the main flow. */
                        { /* Forcing to load Custom Culture when showing proper message to user for Mutex implementation  */
                         /* IN006018 and IN007009 */
                         //logicpos.shared.App.CustomRegion.RegisterCustomRegion();
                         //Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(GlobalFramework.Settings["customCultureResourceDefinition"]);
                        }

                        Utils.ShowMessageNonTouch(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_pos_instance_already_running"), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_information"));
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Beispiel #2
0
        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);
            }
        }