Load() public method

public Load ( string fileName ) : void
fileName string
return void
Exemplo n.º 1
0
        void OnBackendChanged(ApplicationBackend oldBackend)
        {
            if (oldBackend != null)
            {
                tmpProjectFile = Path.GetTempFileName();
                backend.Save(tmpProjectFile);
                backend.Dispose();
            }

            backend = app.Backend.CreateProject();
            backend.SetFrontend(this);

            if (tmpProjectFile != null && File.Exists(tmpProjectFile))
            {
                backend.Load(tmpProjectFile, fileName);
                File.Delete(tmpProjectFile);
                tmpProjectFile = null;
            }
            else if (fileName != null)
            {
                backend.Load(fileName);
            }

            if (resourceProvider != null)
            {
                backend.ResourceProvider = resourceProvider;
            }

            if (BackendChanged != null)
            {
                BackendChanged(oldBackend);
            }

            if (ProjectReloaded != null)
            {
                ProjectReloaded(this, EventArgs.Empty);
            }
        }
Exemplo n.º 2
0
        public ProjectBackend LoadProject(string path)
        {
            ProjectBackend p = new ProjectBackend(this);

            if (System.IO.Path.GetExtension(path) == ".glade")
            {
                GladeFiles.Import(p, path);
            }
            else
            {
                p.Load(path);
            }
            return(p);
        }
        public void Load(string fileName)
        {
            this.fileName = fileName;
            if (backend != null)
            {
                backend.Load(fileName);
            }

            using (StreamReader sr = new StreamReader(fileName))
            {
                XmlTextReader reader = new XmlTextReader(sr);

                reader.MoveToContent();
                if (reader.IsEmptyElement)
                {
                    return;
                }

                reader.ReadStartElement("stetic-interface");
                if (reader.IsEmptyElement)
                {
                    return;
                }
                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (reader.LocalName == "widget")
                        {
                            ReadWidget(reader);
                        }
                        else if (reader.LocalName == "action-group")
                        {
                            ReadActionGroup(reader);
                        }
                        else
                        {
                            reader.Skip();
                        }
                    }
                    else
                    {
                        reader.Skip();
                    }
                    reader.MoveToContent();
                }
            }
        }
Exemplo n.º 4
0
		void OnBackendChanged (ApplicationBackend oldBackend)
		{
			if (oldBackend != null) {
				tmpProjectFile = Path.GetTempFileName ();
				backend.Save (tmpProjectFile);
				backend.Dispose ();
			}
			
			backend = app.Backend.CreateProject ();
			backend.SetFrontend (this);

			if (tmpProjectFile != null && File.Exists (tmpProjectFile)) {
//				backend.Load (tmpProjectFile, fileName);
				throw new NotImplementedException ("OnBackendChanged");
				File.Delete (tmpProjectFile);
				tmpProjectFile = null;
			} else if (folderName != null) {
				backend.Load (folderName);
			}

			if (resourceProvider != null)
				backend.ResourceProvider = resourceProvider;

			if (BackendChanged != null)
				BackendChanged (oldBackend);
				
			if (ProjectReloaded != null)
				ProjectReloaded (this, EventArgs.Empty);
		}
Exemplo n.º 5
0
		public ProjectBackend LoadProject (string path)
		{
			ProjectBackend p = new ProjectBackend (this);
			
			if (System.IO.Path.GetExtension (path) == ".glade") {
				GladeFiles.Import (p, path);
			} else {
				p.Load (path);
			}
			return p;
		}
Exemplo n.º 6
0
        public void Load(string folderName)
        {
            this.folderName = folderName;
            if (backend != null)
            {
                backend.Load(folderName);
            }

            foreach (string basePath in DesignInfo.GetComponentFolders())
            {
                if (!Directory.Exists(basePath))
                {
                    continue;
                }

                DirectoryInfo dir = new DirectoryInfo(basePath);

                foreach (FileInfo file in dir.GetFiles())
                {
                    if (file.Extension == ".gtkx")
                    {
                        using (StreamReader sr = new StreamReader(file.FullName)) {
                            XmlTextReader reader = new XmlTextReader(sr);

                            reader.MoveToContent();
                            if (reader.IsEmptyElement)
                            {
                                return;
                            }

                            reader.ReadStartElement("stetic-interface");
                            if (reader.IsEmptyElement)
                            {
                                return;
                            }
                            while (reader.NodeType != XmlNodeType.EndElement)
                            {
                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    if (reader.LocalName == "widget")
                                    {
                                        ReadWidget(reader);
                                    }
                                    else if (reader.LocalName == "action-group")
                                    {
                                        ReadActionGroup(reader);
                                    }
                                    else
                                    {
                                        reader.Skip();
                                    }
                                }
                                else
                                {
                                    reader.Skip();
                                }
                                reader.MoveToContent();
                            }
                        }
                    }
                }
            }
        }