Exemple #1
0
        /// <summary>
        /// ARQODE_Core Load application (System app by default)
        /// </summary>
        public ACORE(string app_path = "")
        {
            Initialize_ARQODE_Core(app_path);

            if ((!_system.hasErrors()) && (!ErrorsLoadingViews))
            {
                // Update views if changes
                if (_system.Globals.ActiveAppName == dGLOBALS.SYSTEM_APP)
                {
                    string Arqode_app_path = _system.Globals.ARQODE_APP;
                    string Sys_app_path    = _system.Globals.App_path.FullName;
                    string ActiveApp       = _system.Globals.ActiveAppName;
                    string App_path        = _system.Globals.App_path.FullName;

                    // get map vars code
                    CMap cmap = new CMap(Sys_app_path, App_path, Arqode_app_path, ActiveApp);

                    // Map changes in views
                    cmap.MapViews();
                }
                MainForm.FormClosed += MainForm_FormClosed;
            }
        }
Exemple #2
0
        private void CopyViews()
        {
            #region ReMap Views

            TLogic.CMap CMap = new CMap(SYS_PATH, APP_PATH, ARQODE_PATH, APP_NAME);
            CMap.MapViews(true);
            #endregion

            String map_views_path = Path.Combine(APP_VSPROJECT_PATH, dEXPORTCODE.VS_PJ_UI_PATH);

            DirectoryInfo source_pj_ui_path = new DirectoryInfo(ARQODE_UI_PATH);

            FileInfo[] views = DAPP_VIEWS.GetFiles("*.json", SearchOption.AllDirectories);
            foreach (FileInfo fview in views)
            {
                if (!fview.Name.Equals(dCONTROLS.BASE_CONTROL))
                {
                    try
                    {
                        #region Get SSource file
                        String file_name     = fview.Name.Replace(".json", dEXPORTCODE.VIEW_MAP_CS_SUFIX);
                        String relative_path = fview.FullName.Replace(DAPP_VIEWS.FullName, "")
                                               .Replace(".json", dEXPORTCODE.VIEW_MAP_CS_SUFIX);
                        FileInfo[] sourcefiles = source_pj_ui_path.GetFiles(file_name, SearchOption.AllDirectories);
                        if (sourcefiles.Count() > 0)
                        {
                            DateTime modTime       = DateTime.Parse("1/1/200");
                            int      i             = 0;
                            int      lastMod_index = -1;
                            foreach (FileInfo sourcef in sourcefiles)
                            {
                                if (modTime < sourcef.LastWriteTime)
                                {
                                    modTime       = sourcef.LastWriteTime;
                                    lastMod_index = i;
                                }
                                i++;
                            }
                            copy_from_relative_path(map_views_path, sourcefiles[lastMod_index],
                                                    relative_path);
                            #endregion

                            #region get view file

                            file_name = fview.Name.Replace(".json", ".*");
                            FileInfo[] viewsfiles = source_pj_ui_path.GetFiles(file_name, SearchOption.AllDirectories);
                            foreach (FileInfo viewfile in viewsfiles)
                            {
                                if (viewfile.Name.EndsWith(dEXPORTCODE.VS_PJ_DESIGNER_SUF))
                                {
                                    copy_from_relative_path(map_views_path, viewfile,
                                                            relative_path.Substring(0, relative_path.LastIndexOf("\\") + 1) + viewfile.Name);
                                }
                                else if ((viewfile.Name.EndsWith(".cs")) && (!viewfile.Name.EndsWith(dEXPORTCODE.VIEW_MAP_CS_SUFIX)))
                                {
                                    copy_from_relative_path(map_views_path, viewfile,
                                                            relative_path.Substring(0, relative_path.LastIndexOf("\\") + 1) + viewfile.Name);
                                }
                                else
                                {
                                    copy_from_relative_path(map_views_path, viewfile,
                                                            relative_path.Substring(0, relative_path.LastIndexOf("\\") + 1) + viewfile.Name);
                                }
                            }
                            #endregion
                        }
                    }
                    catch (Exception exc)
                    {
                        System.Windows.Forms.MessageBox.Show("Error: " + exc.Message);
                    }
                }
            }
        }