private void mnu_editConnect(object sender, EventArgs e)
        {
            TreeViewObjectExplorer tv = TreeView as TreeViewObjectExplorer;

            if (TreeView != null)
            {
                TreeNodeObject np   = null;
                ClassPointer   root = null;
                TreeNode       tn   = this.Parent;
                while (tn != null)
                {
                    np = tn as TreeNodeObject;
                    if (np != null)
                    {
                        root = np.OwnerIdentity as ClassPointer;
                        if (root != null)
                        {
                            break;
                        }
                    }
                    tn = tn.Parent;
                }
                if (root != null)
                {
                    LimnorProject.SetActiveProject(root.Project);
                    DlgConnectionManager dlg = new DlgConnectionManager();
                    dlg.UseProjectScope = true;
                    dlg.EnableCancel(false);
                    //set selection of _connect
                    dlg.SetSelection(_connect);
                    dlg.ShowDialog(TreeView.FindForm());
                    np.ResetNextLevel(tv);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// it must be called from a separated app domain other than the designer.
        /// </summary>
        /// <param name="xmlFile"></param>
        public void Load(string xmlFile)
        {
            ProjectEnvironment.RunMode = true;
            XmlDocument doc = new XmlDocument();

            doc.Load(xmlFile);
            XmlNode       _node   = doc.DocumentElement;
            LimnorProject project = new LimnorProject(LimnorProject.GetProjectFileByComponentFile(xmlFile));
            //create root object
            UInt32          classId  = XmlUtil.GetAttributeUInt(_node, XmlTags.XMLATT_ClassID);
            UInt32          memberId = XmlUtil.GetAttributeUInt(_node, XmlTags.XMLATT_ComponentID);
            ObjectIDmap     map      = new ObjectIDmap(project, DesignUtil.MakeDDWord(memberId, classId), _node);
            XmlObjectReader xr       = new XmlObjectReader(map, ClassPointer.OnAfterReadRootComponent, ClassPointer.OnRootComponentCreated);

            map.SetReader(xr);
            _rootId = new ClassPointer(classId, memberId, map, null);
            string          file   = project.GetComponentFileByClassId(classId);
            ComponentLoader loader = new ComponentLoader(xr, file);
            DesignSurface   ds     = new DesignSurface();

            ds.BeginLoad(loader);
            if (xr.Errors != null && xr.Errors.Count > 0)
            {
                MathNode.Log(xr.Errors);
            }
            _rootId.LoadActionInstances();
        }
 public void SetData(ILimnorDesignPane designer)
 {
     _designPane      = designer;
     _prj             = designer.Loader.Project;
     labelFolder.Text = _prj.ProjectFolder;
     labelIDE.Text    = Path.GetDirectoryName(Application.ExecutablePath);
 }
        public List <ProjectDependencies> GetDependencies()
        {
            List <ProjectDependencies> lst = new List <ProjectDependencies>();

            for (int i = 0; i < Nodes.Count; i++)
            {
                ProjectNode pn = Nodes[i] as ProjectNode;
                if (pn != null)
                {
                    ProjectNodeData      pnd  = pn.PropertyObject as ProjectNodeData;
                    LimnorProject        lp   = pnd.Project;
                    IList <Guid>         pids = pn.DependedProjects;
                    List <LimnorProject> ps   = new List <LimnorProject>();
                    if (pids != null && pids.Count > 0)
                    {
                        foreach (Guid g in pids)
                        {
                            LimnorProject dp = LimnorSolution.Solution.GetProjectByGuid(g);
                            if (dp != null)
                            {
                                ps.Add(dp);
                            }
                        }
                    }
                    ProjectDependencies pds = new ProjectDependencies(lp, ps);
                    lst.Add(pds);
                }
            }
            return(lst);
        }
Beispiel #5
0
        public bool Edit(XmlObjectWriter writer, IMethod context, Form caller, bool isNewAction)
        {
            LimnorProject        project = _class.Project;
            FormActionParameters dlgData = new FormActionParameters();

            if (_parameters == null)
            {
                _parameters = new ParameterValueCollection();
            }
            ActionMethod.ValidateParameterValues(_parameters);
            dlgData.SetScopeMethod(context);
            dlgData.LoadAction(this, _class.XmlData);
            DialogResult ret = dlgData.ShowDialog(caller);

            if (ret == DialogResult.OK)
            {
                _class.SaveAction(this, writer);
                ILimnorDesignPane pane = project.GetTypedData <ILimnorDesignPane>(_class.ClassId);
                if (pane != null)
                {
                    pane.OnActionChanged(_class.ClassId, this, isNewAction);
                    pane.OnNotifyChanges();
                }
                else
                {
                    DesignUtil.WriteToOutputWindowAndLog("Error editong ActionAssignInstance. ClassPointer [{0}] is not in design mode when creating an action. Please close the design pane and re-open it.", _class.ClassId);
                }
                return(true);
            }
            return(false);
        }
Beispiel #6
0
        public static VirtualWebDir CreateWebSite(LimnorProject project, string websitename, Form owner)
        {
            bool          iisError = false;
            VirtualWebDir webSite  = project.GetTestWebSite(owner);

            if (webSite == null)
            {
                webSite = IisUtility.FindLocalWebSiteByName(owner, websitename, out iisError);
            }
            if (webSite == null && !iisError)
            {
                webSite = IisUtility.FindLocalWebSite(websitename);
                if (webSite == null)
                {
                    //create the web site
                    DialogProjectOutput dlg = new DialogProjectOutput();
                    dlg.LoadData(project, websitename);
                    if (dlg.ShowDialog(owner) == DialogResult.OK)
                    {
                        if (dlg.WebSite != null)
                        {
                            webSite = dlg.WebSite;
                        }
                    }
                }
            }
            return(webSite);
        }
 public void RestoreDesignObjects(LimnorProject project)
 {
     if (_rootPointer != null)
     {
         project.SetTypedData <ClassPointer>(_classId, _rootPointer);
     }
     else
     {
         project.RemoveTypedData <ClassPointer>(_classId);
     }
     if (_pane != null)
     {
         project.SetTypedData <ILimnorDesignPane>(_classId, _pane);
     }
     else
     {
         project.RemoveTypedData <ILimnorDesignPane>(_classId);
     }
     if (_map != null)
     {
         project.SetTypedData <ObjectIDmap>(_classId, _map);
     }
     else
     {
         project.RemoveTypedData <ObjectIDmap>(_classId);
     }
 }
        public static DesignObjects RemoveDesignObjects(LimnorProject project, UInt32 classId)
        {
            ClassPointer rootPointer = null;

            if (project.HasTypedData <ClassPointer>(classId))
            {
                rootPointer = project.GetTypedData <ClassPointer>(classId);
            }
            ILimnorDesignPane pane = null;

            if (project.HasTypedData <ILimnorDesignPane>(classId))
            {
                pane = project.GetTypedData <ILimnorDesignPane>(classId);
            }
            ObjectIDmap map = null;

            if (project.HasTypedData <ObjectIDmap>(classId))
            {
                map = project.GetTypedData <ObjectIDmap>(classId);
            }
            DesignObjects obj = new DesignObjects(classId, rootPointer, pane, map);

            project.RemoveTypedData <ILimnorDesignPane>(classId);
            project.RemoveTypedData <ClassPointer>(classId);
            project.RemoveTypedData <ObjectIDmap>(classId);
            return(obj);
        }
Beispiel #9
0
            public ClassTypeList(IWindowsFormsEditorService edSvc, LimnorProject project, ClassTypePointer initSelected)
            {
                _srv = edSvc;
                IList <ComponentID> cis = project.GetAllComponents();

                for (int i = 0; i < cis.Count; i++)
                {
                    if (typeof(Form).IsAssignableFrom(cis[i].ComponentType))
                    {
                        object[] attrs = cis[i].ComponentType.GetCustomAttributes(typeof(SupportFormAttribute), false);
                        if (attrs != null && attrs.Length > 0)
                        {
                            continue;
                        }
                        int k = this.Items.Add(cis[i]);
                        if (this.SelectedIndex < 0)
                        {
                            if (initSelected != null)
                            {
                                if (cis[i].ComponentId == initSelected.ClassId)
                                {
                                    this.SelectedIndex = k;
                                }
                            }
                        }
                    }
                }
            }
        public void GetParameters(string projectFile, string classFile)
        {
            bool          loadedHere = false;
            LimnorProject _project   = new LimnorProject(projectFile);
            XmlDocument   doc        = new XmlDocument();

            doc.Load(classFile);
            UInt32       classId         = XmlUtil.GetAttributeUInt(doc.DocumentElement, XmlTags.XMLATT_ClassID);
            ClassPointer appClassPointer = _project.GetTypedData <ClassPointer>(classId);

            if (appClassPointer == null)
            {
                loadedHere      = true;
                appClassPointer = ClassPointer.CreateClassPointer(_project, doc.DocumentElement);
            }
            if (appClassPointer.ObjectList.Count == 0)
            {
                appClassPointer.ObjectList.LoadObjects();
            }
            _appCodeName = appClassPointer.CodeName;
            LimnorWebApp webapp = appClassPointer.ObjectInstance as LimnorWebApp;

            if (webapp != null)
            {
                _sessionVarCount = webapp.GlobalVariables.Count;
                if (webapp.GlobalVariables.Count > 0)
                {
                    Dictionary <string, string> sessionVars = new Dictionary <string, string>();
                    foreach (SessionVariable sv in webapp.GlobalVariables)
                    {
                        if (!sessionVars.ContainsKey(sv.Name))
                        {
                            if (!sv.Value.IsDefaultValue())
                            {
                                sessionVars.Add(sv.Name, sv.Value.GetValueString());
                            }
                        }
                    }
                    _sessionVarNames  = new string[sessionVars.Count];
                    _sessionVarValues = new string[sessionVars.Count];
                    int idx = 0;
                    foreach (KeyValuePair <string, string> kv in sessionVars)
                    {
                        _sessionVarNames[idx]  = kv.Key;
                        _sessionVarValues[idx] = kv.Value;
                        idx++;
                    }
                }
                _sessionTimeoutMinutes = webapp.GlobalVariableTimeout;
                if (_sessionTimeoutMinutes <= 0)
                {
                    _sessionTimeoutMinutes = 20;
                }
            }
            if (loadedHere)
            {
                _project.RemoveTypedData <ClassPointer>(classId);
            }
        }
Beispiel #11
0
        public override bool ExecuteMenuCommand(LimnorProject project, IClass holder, XmlNode node, MultiPanes pane, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            EventPointer ep = new EventPointer();

            ep.SetEventInfo(_val);
            ep.Owner = Owner;
            return(pane.AssignActions(ep, pane.FindForm()));
        }
        public override bool ExecuteMenuCommand(LimnorProject project, IClass holder, XmlNode node, MultiPanes pane, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            PropertyPointer pp = new PropertyPointer();

            pp.SetPropertyInfo(_val);
            pp.Owner = Owner;
            return(DesignUtil.CreateSetPropertyAction(pp, pane.Loader.DesignPane, scopeMethod, actsHolder, pane.FindForm()) != null);
        }
Beispiel #13
0
 public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer)
 {
     if (_prj == null)
     {
         _prj = objMap.Project;
     }
     resolveDataType();
 }
 public ComponentID(LimnorProject project, UInt32 id, string name, Type type, string file)
 {
     _prj  = project;
     _cid  = id;
     _name = name;
     _type = type;
     _file = file;
 }
Beispiel #15
0
 public void OnDelayedPostSerialize(ObjectIDmap objMap, XmlNode objectNode, XmlObjectReader reader)
 {
     if (_prj == null)
     {
         _prj = objMap.Project;
     }
     resolveDataType();
 }
 public RootComponentData(bool isMain, ObjectIDmap map, RootClassId rootId, XmlNode xml, LimnorProject prj)
 {
     IsMainRoot   = isMain;
     _objectMap   = map;
     _rootClassId = rootId;
     _node        = xml;
     _project     = prj;
 }
 public void LoadData(LimnorProject project)
 {
     _prj = project;
     VSPrj.PropertyBag sc = _prj.GetWebServiceFiles();
     foreach (Dictionary <string, string> s in sc)
     {
         listBox1.Items.Add(s[XmlTags.XMLATT_filename]);
     }
 }
Beispiel #18
0
 public MethodDataTransfer(ClassPointer owner)
 {
     _rootClass = owner;
     if (_rootClass != null)
     {
         _prj     = _rootClass.Project;
         _classId = _rootClass.ClassId;
     }
 }
Beispiel #19
0
 public void LoadData(LimnorProject proj)
 {
     _resman          = proj.GetProjectSingleData <ProjectResources>();
     _curLanguageName = _resman.DesignerLanguageName;
     _rootTreeNode    = new TreeNodeResourceManager(_resman, false);
     treeView1.Nodes.Add(_rootTreeNode);
     _rootTreeNode.Expand();
     Text = Text + " - " + proj.ProjectName;
 }
 public ObjectIDmap(LimnorProject prj, ObjectIDmap parent, UInt64 componentId, XmlNode data)
     : this(prj, componentId, data)
 {
     ParanetMap = parent;
     if (parent != null)
     {
         parent.AddChildMap(this);
     }
 }
 //
 public ProjectNodeData(LimnorProject project, TreeNode nodes)
     : base(nodes)
 {
     _prj = project;
     _prj.SetAsMainProjectFile();
     Name = project.ProjectAssemblyName;
     this._file.Pattern      = string.Format(System.Globalization.CultureInfo.InvariantCulture, "Limnor project files|*.{0}", NodeDataSolution.FILE_EXT_PROJECT);
     this._file.Title        = "Select Limnor Project File";
     this.OnFilenameChanged += new EventHandler(ProjectNodeData_OnFilenameChanged);
 }
        public override bool ExecuteMenuCommand(LimnorProject project, IClass holder, XmlNode node, MultiPanes pane, IMethod scopeMethod, IActionsHolder actsHolder)
        {
            IMethodPointer mi = DesignUtil.EditFrequentlyUsedMethodList(project, node, _menuData, pane.Loader.DesignPane, pane.FindForm());

            if (mi != null)
            {
                return(DesignUtil.OnCreateAction(holder, mi, scopeMethod, actsHolder, pane, node) != null);
            }
            return(false);
        }
Beispiel #23
0
        public static DialogResult EditResources(Form caller, LimnorProject project)
        {
            DlgResMan dlg = new DlgResMan();

            dlg.LoadData(project);
            DialogResult ret = dlg.ShowDialog(caller);

            FrmObjectExplorer.RemoveDialogCaches(project.ProjectGuid, 0);
            return(ret);
        }
        public IClassPointer GetClassPointerFromCache(LimnorProject proj, UInt32 classId)
        {
            ClassPointer cp = proj.GetTypedData <ClassPointer>(classId);

            if (cp == null)
            {
                cp = ClassPointer.CreateClassPointer(classId, proj);
            }
            return(cp);
        }
Beispiel #25
0
 public bool IsInDependencies(LimnorProject p)
 {
     foreach (LimnorProject p0 in _dependencies)
     {
         if (p0.ProjectGuid == p.ProjectGuid)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #26
0
 public void RemoveDependency(LimnorProject project)
 {
     foreach (LimnorProject p in _dependencies)
     {
         if (p.ProjectGuid == project.ProjectGuid)
         {
             _dependencies.Remove(p);
             break;
         }
     }
 }
Beispiel #27
0
 public void AddDependency(LimnorProject project)
 {
     foreach (LimnorProject p in _dependencies)
     {
         if (p.ProjectGuid == project.ProjectGuid)
         {
             return;
         }
     }
     _dependencies.Add(project);
 }
Beispiel #28
0
        public override void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer)
        {
            _prj  = objMap.Project;
            _root = objMap.RootPointer as ClassPointer;
            Type cp = this.ClassType;

            if (cp != null)
            {
                SetLabelText(cp.Name);
            }
        }
Beispiel #29
0
 public MethodDataTransfer(ActionClass act)
 {
     _action  = act;
     _actId   = _action.ActionId;
     _prj     = _action.Project;
     _classId = _action.ClassId;
     if (_prj != null && _classId != 0)
     {
         _rootClass = _prj.GetTypedData <ClassPointer>(_classId);
     }
 }
Beispiel #30
0
 public static VirtualWebDir CreateWebSite(string webSiteName, LimnorProject project, Form caller)
 {
     try
     {
         return(LimnorWebApp.CreateWebSite(project, webSiteName, caller));
     }
     catch (Exception err)
     {
         MathNode.Log(err, "Cannot create website [{0}] on {1}", webSiteName, project.WebPhysicalFolder(caller));
     }
     return(null);
 }