private bool CreateWorkspace(out string workspaceName, out string workspaceRoot, out string workspaceOutput, out string workspaceFile)
        {
            if (cbeWorkspace.ActiveText == worksDefaultName)
            {
                MainClass.Settings.WorkspaceCount = MainClass.Settings.WorkspaceCount + 1;
            }

            TreeIter tiChb;

            cbeWorkspace.GetActiveIter(out tiChb);
            int type = Convert.ToInt32(storeWorkspace.GetValue(tiChb, 2));

            if ((cbeWorkspace.Active < 0) || (type == 2))
            {
                workspaceName = cbeWorkspace.ActiveText;
                workspaceRoot = System.IO.Path.Combine(feLocation.Path, workspaceName);
                bool copyLibs = false;
                workspaceOutput = System.IO.Path.Combine("$(workspace_dir)", "output");
                workspaceFile   = System.IO.Path.Combine(workspaceRoot, workspaceName + ".msw");

                TreeIter ti = AddMessage(MainClass.Languages.Translate("wizzard_create_workspace"), "....", null);

                Workspace.Workspace workspace = null;
                try{
                    workspace = Workspace.Workspace.CreateWorkspace(workspaceFile, workspaceName, workspaceOutput, workspaceRoot, copyLibs);
                }catch (Exception ex) {
                    UpdateMessage(ti, 1, ex.Message);
                    return(false);
                }
                if (workspace != null)
                {
                    MainClass.MainWindow.ReloadWorkspace(workspace, true, true);
                }

                UpdateMessage(ti, 1, "OK");
            }
            else
            {
                //TreeIter tiChb = new TreeIter();
                //cbeWorkspace.GetActiveIter(out tiChb);
                workspaceName = storeWorkspace.GetValue(tiChb, 0).ToString();
                string workspacePath = storeWorkspace.GetValue(tiChb, 1).ToString();
                workspaceRoot   = System.IO.Path.GetDirectoryName(workspacePath);
                workspaceOutput = "";
                workspaceFile   = "";

                Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(workspacePath);
                if (workspace != null)
                {
                    if (workspacePath != MainClass.Workspace.FilePath)
                    {
                        MainClass.MainWindow.ReloadWorkspace(workspace, true, true);
                    }
                    workspaceOutput = workspace.OutputDirectory;
                    workspaceFile   = workspace.FilePath;
                }
            }
            return(true);
        }
Exemple #2
0
 public DrawLayerTask(Workspace.Workspace workspace, Layer layer, MapExtent extent, int width, int height)
 {
     this.workspace = workspace;
     this.layer     = layer;
     this.width     = width;
     this.height    = height;
     this.extent    = extent;
 }
Exemple #3
0
        private void getRecentWorkspace()
        {
            IList <RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace();
            int no = 0;

            foreach (RecentFile rf in lRecentProjects)
            {
                WebButton lb = new WebButton();
                lb.Label        = System.IO.Path.GetFileName(rf.DisplayName);
                lb.HoverMessage = rf.DisplayName;
                //lb.Description=" ";
                lb.WidthRequest = 150;
                string fileName = rf.FileName;
                lb.Clicked += delegate(object sender, EventArgs e) {
                    Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fileName);
                    if (workspace != null)
                    {
                        MainClass.MainWindow.ReloadWorkspace(workspace, false, true);
                    }
                };
                tblAction.Attach(lb, (uint)2, (uint)3, (uint)(no + 2), (uint)(no + 3), AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
                no++;
                if (no >= 2)
                {
                    break;
                }
            }
            if (lRecentProjects.Count > 2)
            {
                DropDownButton.ComboItemSet otherSample = new DropDownButton.ComboItemSet();

                DropDownButton ddbSample = new DropDownButton();
                ddbSample.Relief        = ReliefStyle.None;
                ddbSample.HeightRequest = 25;
                ddbSample.MarkupFormat  = "<span  foreground=\"#697077\"><b>{0}</b></span>";
                ddbSample.WidthRequest  = 150;
                ddbSample.SetItemSet(otherSample);
                for (int i = 3; i < lRecentProjects.Count; i++)
                {
                    DropDownButton.ComboItem addComboItem = new DropDownButton.ComboItem(System.IO.Path.GetFileName(lRecentProjects[i].DisplayName)
                                                                                         , lRecentProjects[i].FileName);
                    otherSample.Add(addComboItem);
                }
                ddbSample.ActiveText = "More...";
                ddbSample.Changed   += delegate(object sender, DropDownButton.ChangedEventArgs e) {
                    if (e.Item != null)
                    {
                        string worksPath = (string)e.Item;
                        Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(worksPath);
                        if (workspace != null)
                        {
                            MainClass.MainWindow.ReloadWorkspace(workspace, true, true);
                        }
                    }
                };
                tblAction.Attach(ddbSample, (uint)2, (uint)3, (uint)(no + 2), (uint)(no + 3), AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            }
        }
        public WorkspaceConnection(ConnectionManager pManager, Workspace.Workspace pWorkspace)
        {
            ConnectionManager = pManager;
            Workspace         = pWorkspace;

            ConnectionManager.StatusChanged += ConnectionManager_StatusChanged;
            Workspace.WorkspaceUpdated      += Workspace_WorkspaceUpdated;
            Workspace.RefreshRequired       += Workspace_RefreshRequired;
        }
Exemple #5
0
 public static Datatable GetTable(Workspace.Workspace ws, Layer layer)
 {
     LsMap.Data.Datasource ds = ws.GetDatasource(layer.DatasourceName);
     if (ds != null)
     {
         LsMap.Data.Datatable dt = ws.GetDatatable(ds, layer.DatatableName);
         return(dt);
     }
     return(null);
 }
Exemple #6
0
 public override void Start()
 {
     try {
         Workspace           = WorkspaceFactory.Get();
         Workspace.Updated  += Workspace_Updated;
         Workspace.Reloaded += Workspace_Reloaded;
     } catch (Exception ex) {
         Log.Error("Failed to set up the workspace monitor, clients will not receive updates");
         Log.Error(ex);
     }
 }
Exemple #7
0
        public void bind()
        {
            Workspace.Workspace work       = new Workspace.Workspace();
            XmlNode             xmlExecute = work.ListPending01(Token);

            if (xmlExecute.Name == "error")
            {
                // Erro ao carregar as tarefas do usuário
            }
            else
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xmlExecute.OuterXml);

                XmlNodeList items = xmlDoc.SelectNodes("/Tasks/Task");

                this.RptPendingTasks.DataSource = items;
                this.RptPendingTasks.DataBind();
            }
        }
        protected override void OnActivated()
        {
            base.OnActivated();

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("chose_workspace_open"), MainClass.MainWindow, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);


            FileFilter filter = new FileFilter();

            filter.Name = "Workspace files";
            filter.AddMimeType("Workspace file");
            filter.AddPattern("*.msw");
            fc.AddFilter(filter);

            if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedWorkspaceDir))
            {
                fc.SetCurrentFolder(MainClass.Settings.LastOpenedWorkspaceDir);
            }


            if (fc.Run() == (int)ResponseType.Accept)
            {
                MainClass.Settings.LastOpenedWorkspaceDir = System.IO.Path.GetDirectoryName(fc.Filename);

                //CloseActualWorkspace();
                Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fc.Filename);

                if (workspace != null)
                {
                    //MainClass.Settings.RecentFiles.AddWorkspace(fc.Filename,fc.Filename);
                    MainClass.MainWindow.ReloadWorkspace(workspace, true, true);
                }
            }

            fc.Destroy();
        }
Exemple #9
0
 public override void Initialize(PreferencesDialog dialog, object dataObject)
 {
     workspace = dataObject as Workspace.Workspace;
     base.Initialize(dialog, dataObject);
 }
Exemple #10
0
        protected override void OnActivated()
        {
            base.OnActivated();

            Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog(MainClass.Languages.Translate("chose_file_open"), MainClass.MainWindow, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
            fc.SetCurrentFolder(MainClass.Workspace.RootDirectory);

            FileFilter filter = new FileFilter();

            filter.Name = "Moscrif file (*.ms,*.mso,*.tab, *.msw)";
            filter.AddMimeType("text/moscrif ");
            filter.AddPattern("*.ms");
            filter.AddPattern("*.msw");
            filter.AddPattern("*.mso");
            filter.AddPattern("*.tab");
            fc.AddFilter(filter);

            filter      = new FileFilter();
            filter.Name = "Moscrif Workspace (*.msw)";
            filter.AddMimeType("text/moscrif ");
            filter.AddPattern("*.msw");
            fc.AddFilter(filter);

            filter      = new FileFilter();
            filter.Name = "PNG and JPEG images (*.png,*.jpg)";
            filter.AddMimeType("image/png");
            filter.AddPattern("*.png");
            filter.AddMimeType("image/jpeg");
            filter.AddPattern("*.jpg");
            fc.AddFilter(filter);

            filter      = new FileFilter();
            filter.Name = "Text file (*.txt)";
            filter.AddMimeType("text/plain");
            filter.AddPattern("*.txt");
            fc.AddFilter(filter);

            filter      = new FileFilter();
            filter.Name = "Xml file (*.xml)";
            filter.AddMimeType("text/xml");
            filter.AddPattern("*.txt");
            fc.AddFilter(filter);

            filter      = new FileFilter();
            filter.Name = "All file ";
            filter.AddPattern("*.*");
            fc.AddFilter(filter);

            if (!String.IsNullOrEmpty(MainClass.Settings.LastOpenedFileDir))
            {
                fc.SetCurrentFolder(MainClass.Settings.LastOpenedFileDir);
            }


            if (fc.Run() == (int)ResponseType.Accept)
            {
                MainClass.Settings.LastOpenedFileDir = System.IO.Path.GetDirectoryName(fc.Filename);

                if (Path.GetExtension(fc.Filename) == ".msp")
                {
                    MainClass.MainWindow.OpenProject(fc.Filename, true);
                }
                else if (Path.GetExtension(fc.Filename) == ".msw")
                {
                    Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fc.Filename);
                    if (workspace != null)
                    {
                        //CloseActualWorkspace();
                        MainClass.MainWindow.ReloadWorkspace(workspace, true, true);
                    }
                }
                else
                {
                    MainClass.MainWindow.OpenFile(fc.Filename, true);
                }
                MainClass.MainWindow.SaveWorkspace();
            }

            fc.Destroy();
        }
Exemple #11
0
 public override void Initialize(PreferencesDialog dialog, object dataObject)
 {
     workspace = dataObject as Workspace.Workspace;
     base.Initialize(dialog, dataObject);
 }
Exemple #12
0
 public DrawRasterTask(Workspace.Workspace workspace, RasterLayer layer, MapExtent extent, int width, int height)
     : base(workspace, layer, extent, width, height)
 {
 }
Exemple #13
0
 public DrawPolygonTask(Workspace.Workspace workspace, PolygonLayer layer, MapExtent extent, int width, int height)
     : base(workspace, layer, extent, width, height)
 {
 }
Exemple #14
0
 public DrawLineTask(Workspace.Workspace workspace, LineLayer layer, MapExtent extent, int width, int height)
     : base(workspace, layer, extent, width, height)
 {
 }