Esempio n. 1
0
		protected override void Run ()
		{
			bool checkForUpdates = PropertyService.Get ("MonoDevelop.Ide.AddinUpdater.CkeckForUpdates", true);
			if (!checkForUpdates)
				return;
			
			DateTime lastUpdate = PropertyService.Get ("MonoDevelop.Ide.AddinUpdater.LastCheck", DateTime.MinValue);
			int updateSpan = PropertyService.Get ("MonoDevelop.Ide.AddinUpdater.UpdateSpanValue", 1);
			string unit = PropertyService.Get ("MonoDevelop.Ide.AddinUpdater.UpdateSpanUnit", "D");
			
			bool check = false;
			if (unit == "D") {
				lastUpdate = lastUpdate.Date;
				check = (DateTime.Now - lastUpdate).TotalDays >= updateSpan;
			} else if (unit == "M") {
				lastUpdate = new DateTime (lastUpdate.Year, lastUpdate.Month, 1, 0, 0, 0);
				check = DateTime.Now >= lastUpdate.AddMonths (updateSpan);
			}
				
			if (check) {
				IProgressMonitor mon = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor ("Looking for add-in updates", "md-software-update"); 
				UpdateMonitor = new AggregatedProgressMonitor (mon);

				Thread t = new Thread (new ThreadStart (UpdateAddins));
				t.Name = "Addin updater";
				t.Start ();
			} else {
				updates = Runtime.AddinSetupService.Repositories.GetAvailableUpdates ();
				if (updates.Length > 0)
					WarnAvailableUpdates ();
			}
		}
		private IProgressMonitor GetBuildProgressMonitor (string statusText)
		{
			Pad pad = IdeApp.Workbench.GetPad<ErrorListPad> ();
			ErrorListPad errorPad = (ErrorListPad) pad.Content;
			AggregatedProgressMonitor mon = new AggregatedProgressMonitor (errorPad.GetBuildProgressMonitor ());
			mon.AddSlaveMonitor (GetStatusProgressMonitor (statusText, Stock.StatusBuild, false, true, false, pad));
			return mon;
		}
		public IProgressMonitor GetBuildProgressMonitor ()
		{
			Pad pad = IdeApp.Workbench.GetPad<ErrorListPad> ();
			ErrorListPad errorPad = (ErrorListPad) pad.Content;
			AggregatedProgressMonitor mon = new AggregatedProgressMonitor (errorPad.GetBuildProgressMonitor ());
			mon.AddSlaveMonitor (GetStatusProgressMonitor (GettextCatalog.GetString ("Building..."), Stock.BuildCombine, false, true, false, pad));
			return mon;
		}
Esempio n. 4
0
        public static void ShowManager()
        {
            IProgressMonitor m = Instance != null ? Instance.updateMonitor : null;
            if (m != null && !m.AsyncOperation.IsCompleted) {
                AggregatedProgressMonitor monitor = new AggregatedProgressMonitor (m);
                monitor.AddSlaveMonitor (new MessageDialogProgressMonitor (true, true, false));
                monitor.AsyncOperation.WaitForCompleted ();
            }
            HideAlert ();

            AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
        }
		protected override bool OnBuild (IProgressMonitor monitor, DeployContext ctx)
		{
			string sourceFile;
			SolutionItem entry = RootSolutionItem;
			if (entry is SolutionFolder)
				sourceFile = entry.ParentSolution.FileName;
			else
				sourceFile = ((SolutionEntityItem)entry).FileName;
			
			AggregatedProgressMonitor mon = new AggregatedProgressMonitor ();
			mon.AddSlaveMonitor (monitor, MonitorAction.WriteLog|MonitorAction.ReportError|MonitorAction.ReportWarning|MonitorAction.ReportSuccess);
			
			string tmpFolder = FileService.CreateTempDirectory ();
			
			try {
				string tf = Path.GetFileNameWithoutExtension (targetFile);
				if (tf.EndsWith (".tar")) tf = Path.GetFileNameWithoutExtension (tf);
				
				string folder = FileService.GetFullPath (Path.Combine (tmpFolder, tf));
				Directory.CreateDirectory (folder);
				
				// Export the project
				
				SolutionItem[] ents = GetChildEntries ();
				string[] epaths = new string [ents.Length];
				for (int n=0; n<ents.Length; n++)
					epaths [n] = ents [n].ItemId;
				
				Services.ProjectService.Export (mon, sourceFile, epaths, folder, FileFormat);
				if (!mon.AsyncOperation.Success)
					return false;
				
				// Create the archive
				string td = Path.GetDirectoryName (targetFile);
				if (!Directory.Exists (td))
					Directory.CreateDirectory (td);
				DeployService.CreateArchive (mon, tmpFolder, targetFile);
			}
			finally {
				Directory.Delete (tmpFolder, true);
			}
			if (monitor.AsyncOperation.Success)
				monitor.Log.WriteLine (GettextCatalog.GetString ("Created file: {0}", targetFile));
			return true;
		}
		public static IProgressMonitor GetInstrumentedMonitor (IProgressMonitor monitor, TimerCounter counter)
		{
			if (enabled) {
				AggregatedProgressMonitor mon = new AggregatedProgressMonitor (monitor);
				mon.AddSlaveMonitor (new IntrumentationMonitor (counter), MonitorAction.Tasks | MonitorAction.WriteLog);
				return mon;
			} else
				return monitor;
		}
		public static IProgressMonitor GetProgressMonitor (string operation)
		{
			IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
			Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (monitor);
			
			AggregatedProgressMonitor mon = new AggregatedProgressMonitor (monitor);
			mon.AddSlaveMonitor (IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (operation, "md-version-control", true, true, false, outPad));
			return mon;
		}
		public static IProgressMonitor GetProgressMonitor (string operation, VersionControlOperationType op)
		{
			IconId icon;
			switch (op) {
			case VersionControlOperationType.Pull: icon = Stock.StatusDownload; break;
			case VersionControlOperationType.Push: icon = Stock.StatusUpload; break;
			default: icon = "md-version-control"; break;
			}

			IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("MonoDevelop.VersionControlOutput", "Version Control", "md-version-control", false, true);
			Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (monitor);
			
			AggregatedProgressMonitor mon = new AggregatedProgressMonitor (monitor);
			mon.AddSlaveMonitor (IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (operation, icon, true, true, false, outPad));
			return mon;
		}
Esempio n. 9
0
		public async static void ShowManager ()
		{
			Task t = Instance != null ? Instance.currentTask : null;

			if (t != null && t.IsCompleted) {
				AggregatedProgressMonitor monitor = new AggregatedProgressMonitor (Instance.updateMonitor);
				monitor.AddSlaveMonitor (new MessageDialogProgressMonitor (true, true, false));
				await t;
			}
			HideAlert ();

			AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
		}
		public static ProgressMonitor GetProgressMonitor (string operation, VersionControlOperationType op)
		{
			IconId padIcon, statusIcon;
			bool cancellable;
			switch (op) {
			case VersionControlOperationType.Pull:
				padIcon = Stock.PadDownload;
				statusIcon = Stock.StatusDownload;
				cancellable = true;
				break;
			case VersionControlOperationType.Push:
				padIcon = Stock.PadUpload;
				statusIcon = Stock.StatusUpload;
				cancellable = true;
				break;
			default:
				padIcon = "md-version-control";
				statusIcon = "md-version-control";
				cancellable = false;
				break;
			}

			ProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor ("MonoDevelop.VersionControlOutput", GettextCatalog.GetString ("Version Control"), padIcon, false, true);
			Pad outPad = IdeApp.Workbench.ProgressMonitors.GetPadForMonitor (monitor);
			
			AggregatedProgressMonitor mon = new AggregatedProgressMonitor (monitor);
			mon.AddFollowerMonitor (IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (operation, statusIcon, true, true, false, outPad, cancellable));
			return mon;
		}