Пример #1
0
    public void ProcessMoveCard()
    {
        movenum = 0;
        List <RectTransform> list = new List <RectTransform>();

        foreach (KeyValuePair <LogicPos, RectTransform> p in CardList)
        {
            var script = p.Value.GetComponent <ObjCard>();
            if (!script.destroy)
            {
                list.Add(p.Value);
            }
            if (script.NeedtoMove())
            {
                StartCoroutine(MoveCard(p.Value));
                movenum = 1;
            }
        }
        CardList.Clear();
        foreach (RectTransform rect in list)
        {
            var script   = rect.GetComponent <ObjCard>();
            var logicpos = new LogicPos(script.posX, script.posY);
            CardList[logicpos] = rect;
        }
        list.Clear();
        if (movenum > 0)
        {
            until = false;
        }
    }
Пример #2
0
        private void InitUI()
        {
            Accordion = new Accordion(GetAccordionDefinition(), SettingsApp.PrivilegesBackOfficeMenuOperationFormat)
            {
                WidthRequest = _widthAccordion
            };
            //Reajustar posição dos Botões do Accordion para 1024x768
            if (GlobalApp.boScreenSize.Height <= 800)
            {
                _fixAccordion.Put(Accordion, 0, 28);
            }
            else
            {
                _fixAccordion.Put(Accordion, 0, 40);
            }
            _fixAccordion.Add(Accordion);
            Accordion.Clicked += accordion_Clicked;
            //_dashboardButton.Clicked += ((AccordionNode)_accordionChildArticlesTemp["Article"]).Clicked;
            //_dashboardButton.Content = ((Widget)_accordionChildDocumentsTemp["DocumentsListall"].Content);
            //_dashboardButton.Content = Utils.GetGenericTreeViewXPO<DashBoard>(this);
            _exitButton.Clicked += delegate { LogicPos.Quit(this); };

            //TK016248 BackOffice - Check New Version
            _NewVersion.Clicked += delegate
            {
                DateTime actualDate = DateTime.Now;
                if (actualDate <= GlobalFramework.LicenceUpdateDate)
                {
                    string fileName       = "\\LPUpdater\\LPUpdater.exe";
                    string lPathToUpdater = FrameworkUtils.OSSlash(string.Format(@"{0}\{1}", Environment.CurrentDirectory, fileName));
                    //string lPathToUpdater = "" + Utils.GetCurrentDirectory() + "\\LPUpdater\\LPUpdater.exe";

                    if (File.Exists(lPathToUpdater))
                    {
                        ResponseType responseType = Utils.ShowMessageTouch(this, DialogFlags.Modal, new System.Drawing.Size(600, 400), MessageType.Question, ButtonsType.YesNo, string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_update_POS"), GlobalFramework.ServerVersion), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_pos_update"));

                        if (responseType == ResponseType.Yes)
                        {
                            System.Diagnostics.Process.Start(lPathToUpdater);
                            //Process.Start(lPathToUpdater);
                            LogicPos.QuitWithoutConfirmation();
                        }
                    }
                }
                else
                {
                    Utils.ShowMessageTouch(this, DialogFlags.Modal, new System.Drawing.Size(600, 400), MessageType.Error, ButtonsType.Ok, string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), GlobalFramework.ServerVersion), resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_license_blocked"));
                }
            };

            //Imagem do dashboard carregada novamente. evento chamado
            _dashboardButton.Clicked += delegate
            {
                _dashboardButton.Content = Utils.GetGenericTreeViewXPO <DashBoard>(this);
                _dashboardButton_Clicked(_dashboardButton, null);
            };

            _backPOS.Clicked += ClickedSystemPos;
        }
Пример #3
0
 /// <summary>
 /// Start application in FrontOffice mode.
 /// Please see IN009005 and IN009034 for details.
 /// </summary>
 private static void StartPOSFrontOffice()
 {
     if (!GlobalFramework.AppUseBackOfficeMode)
     {
         LogicPos logicPos = new LogicPos();
         logicPos.StartApp(AppMode.FrontOffice);
     }
     else
     {
         LogicPos logicPos = new LogicPos();
         logicPos.StartApp(AppMode.Backoffice);
     }
 }
Пример #4
0
    public void SetCardTagPos(uint cardPosX, uint cardPosY, uint tagPosX, uint tagPosY, bool destroy)
    {
        var taglogic = new LogicPos(cardPosX, cardPosY);

        if (CardList.ContainsKey(taglogic))
        {
            var objcard = CardList[taglogic].GetComponent <ObjCard>();
            objcard.preposX = cardPosX;
            objcard.preposY = cardPosY;
            objcard.posX    = tagPosX;
            objcard.posY    = tagPosY;
            objcard.destroy = destroy;
        }
    }
Пример #5
0
    public void ProduceACard()
    {
        uint posX, posY;

        if (GameManager.Instance.ProduceCard(out posX, out posY))
        {
            var numcard = Instantiate(prefabNumber).GetComponent <RectTransform>();
            var script  = numcard.GetComponent <ObjCard>();
            script.Init(posX, posY);
            numcard.SetParent(gameObject.transform);
            numcard.anchoredPosition = GetObjPosition(posX, posY);
            var logicpos = new LogicPos(posX, posY);
            CardList[logicpos] = numcard;
        }
    }
Пример #6
0
    IEnumerator MoveCard(RectTransform card)
    {
        var  script     = card.GetComponent <ObjCard>();
        var  currentpos = card.anchoredPosition;
        var  tagpos     = GetObjPosition(script.posX, script.posY);
        var  speed_x    = (tagpos.x - currentpos.x) / movespeed;
        var  speed_y    = (tagpos.y - currentpos.y) / movespeed;
        bool stop       = false;
        var  movetime   = 0.0f;

        while (!stop)
        {
            movetime += Time.deltaTime;
            if (movetime > movespeed)
            {
                stop = true;
            }
            card.anchoredPosition = new Vector2(card.anchoredPosition.x + speed_x * Time.deltaTime, card.anchoredPosition.y + speed_y * Time.deltaTime);
            yield return(null);
        }
        var logicpos = new LogicPos(script.posX, script.posY);

        if (script.destroy)
        {
            CardList[logicpos].GetComponent <ObjCard>().Number = GameManager.Instance.GetCardNumber(script.posX - 1, script.posY - 1);;
            Destroy(card.gameObject);
        }
        else
        {
            card.anchoredPosition = tagpos;
            script.preposX        = script.posX;
            script.preposY        = script.posY;
            script.Number         = GameManager.Instance.GetCardNumber(script.posX - 1, script.posY - 1);
            CardList[logicpos]    = card;
        }
        MoveFinish();
    }
Пример #7
0
        public LicenseRouter()
        {
            //Local Vars
            string dialogMessage = string.Empty;

            if (showDebug)
            {
                _log.Debug("Debug Mode");
            }

            _loadApp = true;

#if (DEBUG)
            GlobalFramework.LicenceDate       = DateTime.Now.ToString("dd/MM/yyyy");
            GlobalFramework.LicenceVersion    = "POS_CORPORATE";
            GlobalFramework.LicenceName       = "DEBUG";
            GlobalFramework.LicenceHardwareId = "####-####-####-####-####-####";
            //Company Details
            GlobalFramework.LicenceCompany   = "Empresa Demonstração";
            GlobalFramework.LicenceNif       = "NIF Demonstração";
            GlobalFramework.LicenceAddress   = "Morada Demonstração";
            GlobalFramework.LicenceEmail     = "*****@*****.**";
            GlobalFramework.LicenceTelephone = "DEBUG";
#else
            if (showDebug)
            {
                _log.Debug("Not Debug Mode");
            }
#endif

#if (!DEBUG)
            if (showDebug)
            {
                _log.Debug("Before GetLicenceInfo");
            }

            GetLicenceInfo();

            try
            {
                // If Plugin is Not Registered in Container
                if (GlobalFramework.PluginLicenceManager == null)
                {
                    if (showDebug)
                    {
                        _log.Debug("Skip License Manager, Plugin is Not Registered!");
                    }
                }
                // If Plugin Registered in Container
                else
                {
                    byte[] registredLicence = new byte[0];

                    hardwareID = GlobalFramework.PluginLicenceManager.GetHardwareID();
                    GlobalFramework.LicenceHardwareId = hardwareID;
                    _log.Debug("Detected hardwareID: " + GlobalFramework.LicenceHardwareId);
                    string version = "logicpos";

                    //Try Update Licence
                    try
                    {
                        if (GlobalFramework.PluginLicenceManager.GetLicenseInformation().Count > 0)
                        {
                            version = GlobalFramework.PluginLicenceManager.GetLicenseInformation()["version"].ToString();
                        }

                        //Compare WS License with Local License (GlobalFramework.LicenceVersion)
                        registredLicence = GlobalFramework.PluginLicenceManager.GetLicence(hardwareID, version);

                        //If Diferent Licenses return 1 byte and update local license file, else if equal return byte 0, skipping if
                        if (showDebug)
                        {
                            _log.Debug("registredLicence.Length: " + registredLicence.Length);
                        }

                        if (registredLicence.Length > 0)
                        {
                            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);

                            WriteByteArrayToFile(registredLicence, completeFilePath);

                            Utils.ShowMessageTouch(null, DialogFlags.Modal, new System.Drawing.Size(600, 300), MessageType.Info, ButtonsType.Close, Resx.global_information, Resx.dialog_message_license_updated);

                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                    //Detected Blocked Version : Code must be here to works with Online and Offline Mode
                    if (version == "LOGICPOS_BLOCK")
                    {
                        Utils.ShowMessageTouch(null, DialogFlags.Modal, new System.Drawing.Size(600, 300), MessageType.Error, ButtonsType.Close, Resx.global_error, Resx.dialog_message_license_blocked);

                        return;
                    }
                }

                if (showDebug)
                {
                    _log.Debug("Check if need register");
                }

                if (NeedToRegister())
                {
                    if (showDebug)
                    {
                        _log.Debug("Need Register");
                    }

                    //Show Form Register
                    if (showDebug)
                    {
                        _log.Debug("ShowDialog");
                    }
                    LicenseUIResult licenseUIResult = PosLicenceDialog.GetLicenseDetails(hardwareID);
                }
                else
                {
                    _loadApp = true;
                    GlobalFramework.LicenceRegistered = true;
                    _log.Debug("LicenceRegistered: " + GlobalFramework.LicenceRegistered);
                }
            }
            catch (Exception ex)
            {
                _log.Error("Cannot connect with the intellilock WebService: " + ex.Message, ex);
            }
#endif

            if (showDebug)
            {
                _log.Debug("loadPOS = " + _loadApp);
            }

            if (_loadApp)
            {
                LogicPos logicPos = new LogicPos();
                if (showDebug)
                {
                    _log.Debug("StartApp: AppMode.FrontOffice");
                }
                logicPos.StartApp(AppMode.FrontOffice);
            }

            if (showDebug)
            {
                _log.Debug("end");
            }
        }
Пример #8
0
        public static bool Restore(Window pSourceWindow, DataBaseRestoreFrom pRestoreFrom)
        {
            try
            {
                //FrameworkUtils.ShowWaitingCursor();

                Init();

                bool   restoreResult  = false;
                string sql            = string.Empty;
                string fileName       = string.Empty;
                string fileNamePacked = string.Empty;
                //default pathBackups from Settings, can be Overrided in ChooseFromFilePickerDialog Mode
                string pathBackups = _pathBackups;
                DataBaseBackupFileInfo fileInfo = null;
                Guid systemBackupGuid           = Guid.Empty;
                //Required to assign current FileName and FileNamePacked after restore, else name will be the TempName ex acegvpls.soj & n2sjiamk.32o
                sys_systembackup systemBackup = null;
                string           currentFileName = string.Empty, currentFileNamePacked = string.Empty, currentFilePath = string.Empty, currentFileHash = string.Empty;
                sys_userdetail   currentUserDetail = null;

                switch (pRestoreFrom)
                {
                case DataBaseRestoreFrom.SystemBackup:
                    fileInfo = GetSelectRecordFileName(pSourceWindow);
                    //Equal to Filename not FileNamePacked
                    fileNamePacked = fileInfo.FileNamePacked;
                    if (_debug)
                    {
                        _log.Debug(string.Format("RestoreBackup: FileNamePacked:[{0}], FileHashDB:[{1}], FileHashFile:[{2}] FileHashValid:[{3}]", fileInfo.FileNamePacked, fileInfo.FileHashDB, fileInfo.FileHashFile, fileInfo.FileHashValid));
                    }
                    if (fileInfo.Response != ResponseType.Cancel && !fileInfo.FileHashValid)
                    {
                        //#EQUAL#1
                        string message = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_restore_error_invalid_backup_file"), fileNamePacked);
                        Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, new Size(600, 300), MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), message);
                        return(false);
                    }
                    break;

                case DataBaseRestoreFrom.ChooseFromFilePickerDialog:
                    FileFilter          fileFilterBackups = Utils.GetFileFilterBackups();
                    PosFilePickerDialog dialog            = new PosFilePickerDialog(pSourceWindow, DialogFlags.DestroyWithParent, fileFilterBackups, FileChooserAction.Open);
                    ResponseType        response          = (ResponseType)dialog.Run();
                    if (response == ResponseType.Ok)
                    {
                        fileNamePacked = dialog.FilePicker.Filename;
                        //Override Default pathBackups
                        pathBackups = string.Format("{0}/", Path.GetDirectoryName(fileNamePacked));

                        dialog.Destroy();
                    }
                    else
                    {     /* IN009164 */
                        dialog.Destroy();
                        return(false);
                    }
                    break;

                default:
                    break;
                }

                if (GlobalFramework.DatabaseType != DatabaseType.MSSqlServer)
                {
                    fileName = Path.ChangeExtension(fileNamePacked, _fileExtension);
                }
                else
                {
                    //Require to assign filename and packed filename from fileInfo
                    fileName       = fileInfo.FileName;
                    fileNamePacked = fileInfo.FileName;
                }

                if (fileName != string.Empty)
                {
                    if (_debug)
                    {
                        _log.Debug(string.Format("Restore Filename:[{0}] to pathBackups[{1}]", fileNamePacked, pathBackups));
                    }
                    if (GlobalFramework.DatabaseType != DatabaseType.MSSqlServer)
                    {
                        // Old Method before PluginSoftwareVendor Implementation
                        //restoreResult = Utils.ZipUnPack(fileNamePacked, pathBackups, true);
                        restoreResult = GlobalFramework.PluginSoftwareVendor.RestoreBackup(SettingsApp.SecretKey, fileNamePacked, pathBackups, true);
                        if (_debug)
                        {
                            _log.Debug(string.Format("RestoreBackup: unpackResult:[{0}]", restoreResult));
                        }
                    }

                    if (restoreResult || GlobalFramework.DatabaseType == DatabaseType.MSSqlServer)
                    {
                        //Get properties from SystemBackup Object before Restore, to Assign Properties after Restore (FilePath,FileHash,User,Terminal)
                        sql = string.Format("SELECT Oid FROM sys_systembackup WHERE fileNamePacked = '{0}';", Path.GetFileName(fileNamePacked));
                        systemBackupGuid = FrameworkUtils.GetGuidFromQuery(sql);
                        if (systemBackupGuid != Guid.Empty)
                        {
                            systemBackup          = (sys_systembackup)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_systembackup), systemBackupGuid);
                            currentFileName       = systemBackup.FileName;
                            currentFileNamePacked = systemBackup.FileNamePacked;
                            currentFilePath       = systemBackup.FilePath;
                            currentFileHash       = systemBackup.FileHash;
                            currentUserDetail     = systemBackup.User;
                        }

                        //Send fileNamePacked only to show its name in success dialog
                        if (Restore(pSourceWindow, fileName, fileNamePacked, systemBackup))
                        {
                            //Audit DATABASE_RESTORE
                            FrameworkUtils.Audit("DATABASE_RESTORE", string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "audit_message_database_restore"), fileNamePacked));
                            //Required to DropIdentity before get currentDocumentFinanceYear Object, else it exists in old non restored Session
                            GlobalFramework.SessionXpo.DropIdentityMap();
                            //Get Current Active FinanceYear
                            fin_documentfinanceyears currentDocumentFinanceYear = ProcessFinanceDocumentSeries.GetCurrentDocumentFinanceYear();

                            //Disable all Active FinanceYear Series and SeriesTerminal if Exists
                            if (currentDocumentFinanceYear != null)
                            {
                                ProcessFinanceDocumentSeries.DisableActiveYearSeriesAndTerminalSeries(currentDocumentFinanceYear);
                            }

                            //Restore SystemBackup properties else it keeps temp names after Restore acegvpls.soj & n2sjiamk.32o, empty hash etc
                            if (systemBackupGuid != Guid.Empty)
                            {
                                //ReFresh UserDetail from Repository
                                currentUserDetail = (currentUserDetail != null) ? (sys_userdetail)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_userdetail), currentUserDetail.Oid) : null;
                                //Get Current Restored systemBackup Object
                                systemBackup                = (sys_systembackup)FrameworkUtils.GetXPGuidObject(GlobalFramework.SessionXpo, typeof(sys_systembackup), systemBackupGuid);
                                systemBackup.FileName       = currentFileName;
                                systemBackup.FileNamePacked = currentFileNamePacked;
                                systemBackup.FilePath       = currentFilePath;
                                systemBackup.FileHash       = currentFileHash;
                                systemBackup.User           = currentUserDetail;
                                systemBackup.Save();
                            }
                            //If Cant get Record, because works on ChooseFromFilePickerDialog, we must recreate Record from file, only in the case of record with miss fileNamePacked
                            else
                            {
                                sql = "DELETE FROM sys_systembackup WHERE FilePath IS NULL AND FileHash IS NULL AND User IS NULL;";
                                GlobalFramework.SessionXpo.ExecuteNonQuery(sql);
                            }

                            //Audit
                            FrameworkUtils.Audit("APP_CLOSE");
                            //Call QuitWithoutConfirmation without Audit
                            LogicPos.QuitWithoutConfirmation(false);

                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        //#EQUAL#1
                        string message = string.Format(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_message_database_restore_error_invalid_backup_file"), fileNamePacked);
                        Utils.ShowMessageTouch(pSourceWindow, DialogFlags.Modal, new Size(600, 300), MessageType.Error, ButtonsType.Ok, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_error"), message);
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                return(false);
            }
            finally
            {
                //FrameworkUtils.HideWaitingCursor();
            }
        }
Пример #9
0
 IEnumerator MoveCard(RectTransform card)
 {
     var script = card.GetComponent<ObjCard>();
     var currentpos = card.anchoredPosition;
     var tagpos = GetObjPosition(script.posX, script.posY);
     var speed_x = (tagpos.x - currentpos.x) / movespeed;
     var speed_y = (tagpos.y - currentpos.y) / movespeed;
     bool stop = false;
     var movetime = 0.0f;
     while (!stop) {
         movetime += Time.deltaTime;
         if (movetime > movespeed) {
             stop = true;
         }
         card.anchoredPosition = new Vector2(card.anchoredPosition.x + speed_x * Time.deltaTime, card.anchoredPosition.y + speed_y * Time.deltaTime);
         yield return null;
     }
     var logicpos = new LogicPos(script.posX, script.posY);
     if (script.destroy) {
         CardList[logicpos].GetComponent<ObjCard>().Number = GameManager.Instance.GetCardNumber(script.posX-1, script.posY-1);;
         Destroy(card.gameObject);
     } else {
         card.anchoredPosition = tagpos;
         script.preposX = script.posX;
         script.preposY = script.posY;
         script.Number = GameManager.Instance.GetCardNumber(script.posX-1, script.posY-1);
         CardList[logicpos] = card;
     }
     MoveFinish();
 }
Пример #10
0
 public void SetCardTagPos(uint cardPosX, uint cardPosY, uint tagPosX, uint tagPosY, bool destroy)
 {
     var taglogic = new LogicPos(cardPosX, cardPosY);
     if (CardList.ContainsKey(taglogic)) {
         var objcard = CardList[taglogic].GetComponent<ObjCard>();
         objcard.preposX = cardPosX;
         objcard.preposY = cardPosY;
         objcard.posX = tagPosX;
         objcard.posY = tagPosY;
         objcard.destroy = destroy;
     }
 }
Пример #11
0
 public void ProduceACard()
 {
     uint posX, posY;
     if(GameManager.Instance.ProduceCard(out posX, out posY)) {
         var numcard = Instantiate(prefabNumber).GetComponent<RectTransform>();
         var script = numcard.GetComponent<ObjCard>();
         script.Init(posX, posY);
         numcard.SetParent(gameObject.transform);
         numcard.anchoredPosition = GetObjPosition(posX, posY);
         var logicpos = new LogicPos(posX, posY);
         CardList[logicpos] = numcard;
     }
 }
Пример #12
0
 public void ProcessMoveCard()
 {
     movenum = 0;
     List<RectTransform> list = new List<RectTransform>();
     foreach (KeyValuePair<LogicPos, RectTransform> p in CardList) {
         var script = p.Value.GetComponent<ObjCard>();
         if (!script.destroy)
             list.Add(p.Value);
         if (script.NeedtoMove()) {
             StartCoroutine(MoveCard(p.Value));
             movenum = 1;
         }
     }
     CardList.Clear();
     foreach(RectTransform rect in list) {
         var script = rect.GetComponent<ObjCard>();
         var logicpos = new LogicPos(script.posX, script.posY);
         CardList[logicpos] = rect;
     }
     list.Clear();
     if (movenum > 0)
         until = false;
 }
Пример #13
0
        private Dictionary <string, AccordionNode> GetAccordionDefinition()
        {
            _log.Debug("GetAccordionDefinition Begin");

            //Init accordionDefinition
            Dictionary <string, AccordionNode> accordionDefinition = null;

            try
            {
                accordionDefinition = new Dictionary <string, AccordionNode>();

                //Define Start Content with Articles TreeView
                Widget startContent = Utils.GetGenericTreeViewXPO <TreeViewArticle>(this);

                //Hide/Show Current Active Content based on user privileges
                string currentNodePrivilegesToken = string.Format(_privilegesBackOfficeMenuOperation, "Article".ToUpper());
                startContent.Sensitive = FrameworkUtils.HasPermissionTo(currentNodePrivilegesToken);

                _labelActiveContent.Text = Resx.global_articles;
                _nodeContent             = startContent;

                _hboxContent.PackEnd(_nodeContent);

                //Define used CriteriaOperators/Override Defaults from TreeViews
                CriteriaOperator criteriaOperatorCustomer = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (Hidden IS NULL OR Hidden = 0)");
                CriteriaOperator criteriaConfigurationPreferenceParameterCompany = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (Token <> 'COMPANY_COUNTRY_OID' AND Token <> 'SYSTEM_CURRENCY_OID' AND FormType = 1)");
                CriteriaOperator criteriaConfigurationPreferenceParameterSystem  = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (FormType = 2)");

                //Articles
                Dictionary <string, AccordionNode> _accordionChildArticles = new Dictionary <string, AccordionNode>();
                //, Clicked = testClickedEventHandlerFromOutside }
                _accordionChildArticles.Add("ArticleFamily", new AccordionNode(Resx.global_families)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleFamily>(this)
                });
                _accordionChildArticles.Add("ArticleSubFamily", new AccordionNode(Resx.global_subfamilies)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleSubFamily>(this)
                });
                _accordionChildArticles.Add("Article", new AccordionNode(Resx.global_articles)
                {
                    Content = startContent
                });
                _accordionChildArticles.Add("ArticleType", new AccordionNode(Resx.global_article_types)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleType>(this)
                });
                _accordionChildArticles.Add("ArticleClass", new AccordionNode(Resx.global_article_class)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewArticleClass>(this)
                });
                _accordionChildArticles.Add("ConfigurationPriceType", new AccordionNode(Resx.global_price_type)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPriceType>(this)
                });
                // Disable to Speed uo Opening BO, noew we have Stock Reports
                //_accordionChildArticles.Add("ArticleStock", new AccordionNode(Resx.global_stock_movements) { Content = Utils.GetGenericTreeViewXPO<TreeViewArticleStock>(this) });

                //Customers
                Dictionary <string, AccordionNode> _accordionChildCustomers = new Dictionary <string, AccordionNode>();
                _accordionChildCustomers.Add("Customer", new AccordionNode(Resx.global_customers)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewCustomer>(this, criteriaOperatorCustomer)
                });
                _accordionChildCustomers.Add("CustomerType", new AccordionNode(Resx.global_customer_types)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewCustomerType>(this)
                });
                _accordionChildCustomers.Add("CustomerDiscountGroup", new AccordionNode(Resx.global_customer_discount_groups)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewCustomerDiscountGroup>(this)
                });

                //Users
                Dictionary <string, AccordionNode> _accordionChildUsers = new Dictionary <string, AccordionNode>();
                _accordionChildUsers.Add("UserDetail", new AccordionNode(Resx.global_users)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewUser>(this)
                });
                //Commented by Mario: Not Usefull, UserPermissionProfile has same funtionality
                //_accordionChildUsers.Add("UserProfile", new AccordionNode(Resx.global_profile) { Content = Utils.GetGenericTreeViewXPO<TreeViewUserProfile>(this) });
                //WARNING: Works with diferent constructs, its still need to be improved : new TreeViewUserProfilePermissions(this)
                _accordionChildUsers.Add("UserPermissionProfile", new AccordionNode(Resx.global_user_permissions)
                {
                    Content = new TreeViewUserProfilePermissions(this)
                });
                _accordionChildUsers.Add("UserCommissionGroup", new AccordionNode(Resx.global_user_commission_groups)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewUserCommissionGroup>(this)
                });
                //Moved to Custom Toolbar
                //_accordionChildUsers.Add("System_ApplyPrivileges", new AccordionNode(Resx.global_user_apply_privileges) { Clicked = delegate { Accordion.UpdateMenuPrivileges(); } });

                //Documents
                Dictionary <string, AccordionNode> _accordionDocuments = new Dictionary <string, AccordionNode>();
                _accordionDocuments.Add("DocumentFinanceYears", new AccordionNode(Resx.global_documentfinance_years)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceYears>(this)
                });
                _accordionDocuments.Add("DocumentFinanceSeries", new AccordionNode(Resx.global_documentfinance_series)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceSeries>(this)
                });
                _accordionDocuments.Add("DocumentFinanceType", new AccordionNode(Resx.global_documentfinance_type)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceType>(this)
                });
                //_accordionDocuments.Add("DocumentFinanceYearSerieTerminal", new AccordionNode(Resx.global_documentfinance_yearsseriesterminal) { Content = Utils.GetGenericTreeViewXPO<TreeViewDocumentFinanceYearSerieTerminal>(this) });
                _accordionDocuments.Add("ConfigurationVatRate", new AccordionNode(Resx.global_vat_rates)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationVatRate>(this)
                });
                _accordionDocuments.Add("ConfigurationVatExemptionReason", new AccordionNode(Resx.global_vat_exemption_reason)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationVatExceptionReason>(this)
                });
                _accordionDocuments.Add("ConfigurationPaymentCondition", new AccordionNode(Resx.global_payment_conditions)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPaymentCondition>(this)
                });
                _accordionDocuments.Add("ConfigurationPaymentMethod", new AccordionNode(Resx.global_payment_methods)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPaymentMethod>(this)
                });

                //AuxiliarTables
                Dictionary <string, AccordionNode> _accordionChildAuxiliarTables = new Dictionary <string, AccordionNode>();
                //_accordionChildAuxiliarTables.Add("ConfigurationCashRegister", new AccordionNode(Resx.global_cash_registers) { Content = Utils.GetGenericTreeView<TreeViewConfigurationCashRegister>(this) });
                _accordionChildAuxiliarTables.Add("ConfigurationCountry", new AccordionNode(Resx.global_country)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationCountry>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationCurrency", new AccordionNode(Resx.global_ConfigurationCurrency)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationCurrency>(this)
                });
                //_accordionChildAuxiliarTables.Add("ConfigurationDevice", new AccordionNode(Resx.global_devices) { Content = Utils.GetGenericTreeView<TreeViewConfigurationDevice>(this) });
                //_accordionChildAuxiliarTables.Add("ConfigurationKeyboard", new AccordionNode(Resx.global_keyboards) { Content = Utils.GetGenericTreeView<TreeViewConfigurationKeyboard>(this) });
                //_accordionChildAuxiliarTables.Add("ConfigurationMaintenance", new AccordionNode(Resx.global_maintenance) { Content = Utils.GetGenericTreeView<TreeViewConfigurationMaintenance>(this) });
                _accordionChildAuxiliarTables.Add("ConfigurationPlace", new AccordionNode(Resx.global_places)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlace>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationPlaceTable", new AccordionNode(Resx.global_place_tables)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTable>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationPlaceMovementType", new AccordionNode(Resx.global_places_movement_type)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceMovementType>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationUnitMeasure", new AccordionNode(Resx.global_units_measure)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationUnitMeasure>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationUnitSize", new AccordionNode(Resx.global_units_size)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationUnitSize>(this)
                });
                _accordionChildAuxiliarTables.Add("ConfigurationHolidays", new AccordionNode(Resx.global_holidays)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationHolidays>(this)
                });

                //Devices
                Dictionary <string, AccordionNode> _accordionDevices = new Dictionary <string, AccordionNode>();
                _accordionDevices.Add("ConfigurationPrintersType", new AccordionNode(Resx.global_ConfigurationPrintersType)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPrintersType>(this)
                });
                _accordionDevices.Add("ConfigurationPrinters", new AccordionNode(Resx.global_ConfigurationPrinters)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPrinters>(this)
                });
                _accordionDevices.Add("ConfigurationInputReader", new AccordionNode(Resx.global_ConfigurationInputReader)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationInputReader>(this)
                });
                _accordionDevices.Add("ConfigurationPoleDisplay", new AccordionNode(Resx.global_ConfigurationPoleDisplay)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPoleDisplay>(this)
                });
                _accordionDevices.Add("ConfigurationWeighingMachine", new AccordionNode(Resx.global_ConfigurationWeighingMachine)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationWeighingMachine>(this)
                });
                // Deprecated
                //_accordionPrinters.Add("ConfigurationPrintersTemplates", new AccordionNode(Resx.global_ConfigurationPrintersTemplates) { Content = Utils.GetGenericTreeViewXPO<TreeViewConfigurationPrintersTemplates>(this) });
                //_accordionPrinters.Add("ExternalApp_Composer", new AccordionNode(Resx.global_callposcomposer) { Content = null, ExternalAppFileName = SettingsApp.ExecutableComposer });

                //Configuration
                Dictionary <string, AccordionNode> _accordionChildConfiguration = new Dictionary <string, AccordionNode>();
                _accordionChildConfiguration.Add("ConfigurationPreferenceParameterCompany", new AccordionNode(Resx.global_preferenceparameter_company)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPreferenceParameter>(this, criteriaConfigurationPreferenceParameterCompany)
                });
                _accordionChildConfiguration.Add("ConfigurationPreferenceParameterSystem", new AccordionNode(Resx.global_preferenceparameter_system)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPreferenceParameter>(this, criteriaConfigurationPreferenceParameterSystem)
                });
                _accordionChildConfiguration.Add("ConfigurationPlaceTerminal", new AccordionNode(Resx.global_places_terminals)
                {
                    Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTerminal>(this)
                });

                // Add Menu Items Based On Plugins PluginSoftwareVendor
                Dictionary <string, AccordionNode> _accordionChildExport = new Dictionary <string, AccordionNode>();
                //Export
                if (GlobalFramework.PluginSoftwareVendor != null && SettingsApp.ConfigurationSystemCountry.Oid == SettingsApp.XpoOidConfigurationCountryPortugal)
                {
                    _accordionChildExport.Add("System_ExportSaftPT_SaftPt", new AccordionNode(Resx.global_export_saftpt_whole_year)
                    {
                        Clicked = delegate { FrameworkCalls.ExportSaftPt(this, ExportSaftPtMode.WholeYear); }
                    });
                    _accordionChildExport.Add("System_ExportSaftPT_E-Fatura", new AccordionNode(Resx.global_export_saftpt_last_month)
                    {
                        Clicked = delegate { FrameworkCalls.ExportSaftPt(this, ExportSaftPtMode.LastMonth); }
                    });
                    _accordionChildExport.Add("System_ExportSaftPT_Custom", new AccordionNode(Resx.global_export_saftpt_custom)
                    {
                        Clicked = delegate { FrameworkCalls.ExportSaftPt(this, ExportSaftPtMode.Custom); }
                    });
                }

                //System
                Dictionary <string, AccordionNode> _accordionChildSystem = new Dictionary <string, AccordionNode>();
                // Add Menu Items Based On Plugins PluginSoftwareVendor
                if (GlobalFramework.PluginSoftwareVendor != null)
                {
                    _accordionChildSystem.Add("System_DataBaseBackup", new AccordionNode(Resx.global_database_backup)
                    {
                        Clicked = delegate { DataBaseBackup.Backup(this); }
                    });
                    _accordionChildSystem.Add("System_DataBaseRestore_FromSystem", new AccordionNode(Resx.global_database_restore)
                    {
                        Clicked = delegate { DataBaseBackup.Restore(this, DataBaseRestoreFrom.SystemBackup); }
                    });
                    _accordionChildSystem.Add("System_DataBaseRestore_FromFile", new AccordionNode(Resx.global_database_restore_from_file)
                    {
                        Clicked = delegate { DataBaseBackup.Restore(this, DataBaseRestoreFrom.ChooseFromFilePickerDialog); }
                    });
                }
                _accordionChildSystem.Add("System_Menu", new AccordionNode(Resx.global_application_logout_user)
                {
                    Clicked = ClickedSystemLogout
                });
                _accordionChildSystem.Add("System_Pos", new AccordionNode(Resx.global_pos)
                {
                    Clicked = ClickedSystemPos
                });
                _accordionChildSystem.Add("System_Quit", new AccordionNode(Resx.global_quit)
                {
                    Clicked = delegate { LogicPos.Quit(this); }
                });

                //Compose Main Accordion Parent Buttons
                accordionDefinition.Add("TopMenuArticles", new AccordionNode(Resx.global_articles)
                {
                    Childs = _accordionChildArticles, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_artigos.png")
                });
                accordionDefinition.Add("TopMenuDocuments", new AccordionNode(Resx.global_documents)
                {
                    Childs = _accordionDocuments, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_informacao_fiscal.png")
                });
                accordionDefinition.Add("TopMenuCustomers", new AccordionNode(Resx.global_customers)
                {
                    Childs = _accordionChildCustomers, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_clientes.png")
                });
                accordionDefinition.Add("TopMenuUsers", new AccordionNode(Resx.global_users)
                {
                    Childs = _accordionChildUsers, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_utilizadores.png")
                });
                accordionDefinition.Add("TopMenuDevices", new AccordionNode(Resx.global_devices)
                {
                    Childs = _accordionDevices, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_impressoras.png")
                });
                accordionDefinition.Add("TopMenuOtherTables", new AccordionNode(Resx.global_other_tables)
                {
                    Childs = _accordionChildAuxiliarTables, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_outras_tabelas.png")
                });
                accordionDefinition.Add("TopMenuConfiguration", new AccordionNode(Resx.global_configuration)
                {
                    Childs = _accordionChildConfiguration, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_configuracao.png")
                });
                if (_accordionChildExport.Count > 0)
                {
                    accordionDefinition.Add("TopMenuExport", new AccordionNode(Resx.global_export)
                    {
                        Childs = _accordionChildExport, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_export.png")
                    });
                }
                accordionDefinition.Add("TopMenuSystem", new AccordionNode(Resx.global_system)
                {
                    Childs = _accordionChildSystem, GroupIcon = new Image("Assets/Images/Icons/Accordion/poson_backoffice_sistema.png")
                });

                _log.Debug("GetAccordionDefinition End");
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            return(accordionDefinition);
        }