Exemplo n.º 1
0
        public void ImportGladeFile()
        {
            var dlg = new MonoDevelop.Components.SelectFileDialog(GettextCatalog.GetString("Open Glade File"));

            dlg.AddFilter(GettextCatalog.GetString("Glade files"), "*.glade");
            dlg.AddAllFilesFilter();
            if (dlg.Run())
            {
                SteticProject.ImportGlade(dlg.SelectedFile);
                SaveAll(true);
            }
        }
Exemplo n.º 2
0
 public override void LaunchDialogue()
 {
     var kindAtt = this.Property.Attributes.OfType<FilePathIsFolderAttribute> ().FirstOrDefault ();
     FileChooserAction action;
     string title;
     if (kindAtt == null) {
         action = FileChooserAction.Open;
         title = GettextCatalog.GetString ("Select File...");
     } else {
         action = FileChooserAction.SelectFolder;
         title = GettextCatalog.GetString ("Select Folder...");
     }
     var fs = new MonoDevelop.Components.SelectFileDialog (title, action);
     if (fs.Run ())
         Property.SetValue (Instance, fs.SelectedFile);
 }
Exemplo n.º 3
0
        public override void LaunchDialogue()
        {
            var kindAtt = this.Property.Attributes.OfType <FilePathIsFolderAttribute> ().FirstOrDefault();
            FileChooserAction action;
            string            title;

            if (kindAtt == null)
            {
                action = FileChooserAction.Open;
                title  = GettextCatalog.GetString("Select File...");
            }
            else
            {
                action = FileChooserAction.SelectFolder;
                title  = GettextCatalog.GetString("Select Folder...");
            }
            var fs = new MonoDevelop.Components.SelectFileDialog(title, action);

            if (fs.Run())
            {
                Property.SetValue(Instance, fs.SelectedFile);
            }
        }
Exemplo n.º 4
0
		public void ImportGladeFile ()
		{
			var dlg = new MonoDevelop.Components.SelectFileDialog (GettextCatalog.GetString ("Open Glade File"));
			dlg.AddFilter (GettextCatalog.GetString ("Glade files"), "*.glade");
			dlg.AddAllFilesFilter ();
			if (dlg.Run ()) {
				SteticProject.ImportGlade (dlg.SelectedFile);
				SaveAll (true);
			}
		}
Exemplo n.º 5
0
		protected override void Run ()
		{
			var proj = DefaultUploadToDeviceHandler.GetActiveExecutableIPhoneProject ();
			var conf = (IPhoneProjectConfiguration)proj.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
			
			IdeApp.ProjectOperations.Build (proj).Completed += delegate (IAsyncOperation op) {
				if (!op.Success) {
					MessageService.ShowError (
						GettextCatalog.GetString ("Cannot zip app bundle"),
						GettextCatalog.GetString ("Project did not build successfully"));
					return;
				}
				
				var dlg = new MonoDevelop.Components.SelectFileDialog (
					GettextCatalog.GetString ("Save zipped app bundle"), Gtk.FileChooserAction.Save);
					dlg.InitialFileName = string.Format ("{0}-{1}.zip", conf.CompiledOutputName.FileNameWithoutExtension, proj.BundleVersion);
					dlg.DefaultFilter = dlg.AddFilter ("Zip file", "*.zip");
				
				if (!dlg.Run ())
					return;
				
				var zipFile = dlg.SelectedFile;
				var builder = new ProcessArgumentBuilder ();
				builder.Add ("-r", "-y");
				builder.AddQuoted (zipFile);
				builder.AddQuoted (conf.AppDirectory.FileName);
				var cmd = builder.ToString ();
				var workingDirectory = conf.AppDirectory.ParentDirectory;
				
				new System.Threading.Thread (delegate () {
					IProgressMonitor monitor = null;
					AggregatedOperationMonitor opMon = null;
					IProcessAsyncOperation procOp = null;
					
					try {
						monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (
							GettextCatalog.GetString ("Zip App Bundle"), MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true);
						monitor.BeginTask (GettextCatalog.GetString ("Zipping app bundle"), 0);
						
						var console = (IConsole) monitor;
						console.Log.WriteLine ("zip " + cmd);
						
						//don't use StartConsoleProcess, it disposes the pad
						procOp = Runtime.ProcessService.StartProcess (
							"zip", cmd, workingDirectory, console.Out, console.Error, null);
						opMon = new AggregatedOperationMonitor (monitor, procOp);
						
						procOp.WaitForCompleted ();
						
						monitor.EndTask ();
							
						if (procOp.ExitCode != 0)
							monitor.ReportError (GettextCatalog.GetString ("Failed to zip app"), null);
						else
							monitor.ReportSuccess (GettextCatalog.GetString ("Saved zipped app to '{0}'", zipFile));
					} catch (Exception ex) {
						LoggingService.LogError ("Error in app zipper", ex);
						//be super-safe, crashing thread crashes whole app
						try {
							monitor.ReportError ("App zipping failed", ex);
						} catch {}
					}
					if (opMon != null)
						opMon.Dispose ();
					if (procOp != null)
						procOp.Dispose ();
					if (monitor != null)
						monitor.Dispose ();
				}).Start ();
			};
		}
Exemplo n.º 6
0
        protected override void Run()
        {
            var proj = DefaultUploadToDeviceHandler.GetActiveExecutableIPhoneProject();
            var conf = (IPhoneProjectConfiguration)proj.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);

            IdeApp.ProjectOperations.Build(proj).Completed += delegate(IAsyncOperation op) {
                if (!op.Success)
                {
                    MessageService.ShowError(
                        GettextCatalog.GetString("Cannot zip app bundle"),
                        GettextCatalog.GetString("Project did not build successfully"));
                    return;
                }

                var dlg = new MonoDevelop.Components.SelectFileDialog(
                    GettextCatalog.GetString("Save zipped app bundle"), Gtk.FileChooserAction.Save);
                dlg.InitialFileName = string.Format("{0}-{1}.zip", conf.CompiledOutputName.FileNameWithoutExtension, proj.BundleVersion);
                dlg.DefaultFilter   = dlg.AddFilter("Zip file", "*.zip");

                if (!dlg.Run())
                {
                    return;
                }

                var zipFile = dlg.SelectedFile;
                var builder = new ProcessArgumentBuilder();
                builder.Add("-r", "-y");
                builder.AddQuoted(zipFile);
                builder.AddQuoted(conf.AppDirectory.FileName);
                var cmd = builder.ToString();
                var workingDirectory = conf.AppDirectory.ParentDirectory;

                new System.Threading.Thread(delegate() {
                    IProgressMonitor monitor         = null;
                    AggregatedOperationMonitor opMon = null;
                    IProcessAsyncOperation procOp    = null;

                    try {
                        monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor(
                            GettextCatalog.GetString("Zip App Bundle"), MonoDevelop.Ide.Gui.Stock.RunProgramIcon, true, true);
                        monitor.BeginTask(GettextCatalog.GetString("Zipping app bundle"), 0);

                        var console = (IConsole)monitor;
                        console.Log.WriteLine("zip " + cmd);

                        //don't use StartConsoleProcess, it disposes the pad
                        procOp = Runtime.ProcessService.StartProcess(
                            "zip", cmd, workingDirectory, console.Out, console.Error, null);
                        opMon = new AggregatedOperationMonitor(monitor, procOp);

                        procOp.WaitForCompleted();

                        monitor.EndTask();

                        if (procOp.ExitCode != 0)
                        {
                            monitor.ReportError(GettextCatalog.GetString("Failed to zip app"), null);
                        }
                        else
                        {
                            monitor.ReportSuccess(GettextCatalog.GetString("Saved zipped app to '{0}'", zipFile));
                        }
                    } catch (Exception ex) {
                        LoggingService.LogError("Error in app zipper", ex);
                        //be super-safe, crashing thread crashes whole app
                        try {
                            monitor.ReportError("App zipping failed", ex);
                        } catch {}
                    }
                    if (opMon != null)
                    {
                        opMon.Dispose();
                    }
                    if (procOp != null)
                    {
                        procOp.Dispose();
                    }
                    if (monitor != null)
                    {
                        monitor.Dispose();
                    }
                }).Start();
            };
        }