public AppDelegate () { PrepareCache (); ExtractImages (); controller = new MonodocDocumentController (); // Some UI feature we use rely on Lion, so special case it try { var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist"); isOnLion = version.ObjectForKey (new NSString ("ProductVersion")).ToString ().StartsWith ("10.7"); } catch {} // Load documentation Root = RootTree.LoadTree (null); var macDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "macdoc"); if (!Directory.Exists (macDocPath)) Directory.CreateDirectory (macDocPath); IndexUpdateManager = new IndexUpdateManager (Root.HelpSources.Cast<HelpSource> ().Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip")).Where (File.Exists), macDocPath); BookmarkManager = new BookmarkManager (macDocPath); AppleDocHandler = new AppleDocHandler ("/Library/Frameworks/Mono.framework/Versions/Current/etc/"); // Configure the documentation rendering. SettingsHandler.Settings.EnableEditing = false; SettingsHandler.Settings.preferred_font_size = 200; HelpSource.use_css = true; }
// Call to load from the XIB/NIB file public AppleDocWizardController () : base ("AppleDocWizard") { Window.CancellationSource = source; handler = new AppleDocHandler (); handler.AppleDocProgress += HandleAppleDocProgress; VerifyFreshnessAndLaunchDocProcess (); }
public override void FinishedLaunching(NSObject notification) { // Check if we are loaded with a search term and load a document for it var args = Environment.GetCommandLineArgs(); NSError error; var searchArgIdx = Array.IndexOf <string> (args, "--search"); if (searchArgIdx != -1 && args.Length > searchArgIdx + 1 && !string.IsNullOrEmpty(args [searchArgIdx + 1])) { var document = controller.OpenUntitledDocument(true, out error); if (document != null) { ((MyDocument)document).LoadWithSearch(args[searchArgIdx + 1]); } } var indexManager = IndexUpdateManager; indexManager.CheckIndexIsFresh().ContinueWith(t => { if (t.IsFaulted) { Logger.LogError("Error while checking indexes", t.Exception); } else if (!t.Result) { indexManager.PerformSearchIndexCreation(); } else { indexManager.AdvertiseFreshIndex(); } }).ContinueWith(t => Logger.LogError("Error while creating indexes", t.Exception), TaskContinuationOptions.OnlyOnFaulted); // Check if there is a MonoTouch documentation installed and launch accordingly if (Root.HelpSources.Cast <HelpSource> ().Any(hs => hs != null && hs.Name != null && hs.Name.StartsWith("MonoTouch", StringComparison.InvariantCultureIgnoreCase)) && File.Exists(MergeToolPath)) { Task.Factory.StartNew(() => { AppleDocHandler.AppleDocInformation infos; bool mergeOutdated = false; bool docOutdated = AppleDocHandler.CheckAppleDocFreshness(AppleDocHandler.IosAtomFeed, out infos); if (!docOutdated) { mergeOutdated = AppleDocHandler.CheckMergedDocumentationFreshness(infos); } return(Tuple.Create(docOutdated || mergeOutdated, docOutdated, mergeOutdated)); }).ContinueWith(t => { Logger.Log("Merged status {0}", t.Result); if (!t.Result.Item1) { return; } BeginInvokeOnMainThread(() => LaunchDocumentationUpdate(t.Result.Item2, t.Result.Item3)); }); } }
public override void FinishedLaunching(NSObject notification) { var indexManager = IndexUpdateManager; indexManager.CheckIndexIsFresh().ContinueWith(t => { if (t.IsFaulted) { Console.WriteLine("Error while checking indexes: {0}", t.Exception); } else if (!t.Result) { indexManager.PerformSearchIndexCreation(); } else { indexManager.AdvertiseFreshIndex(); } }).ContinueWith(t => Console.WriteLine("Error while creating indexes: {0}", t.Exception), TaskContinuationOptions.OnlyOnFaulted); // Check if there is a MonoTouch documentation installed and launch accordingly if (Root.HelpSources.Cast <HelpSource> ().Any(hs => hs != null && hs.Name != null && hs.Name.StartsWith("MonoTouch", StringComparison.InvariantCultureIgnoreCase)) && File.Exists(mergeToolPath)) { Task.Factory.StartNew(() => { AppleDocHandler.AppleDocInformation infos; bool mergeOutdated = false; bool docOutdated = AppleDocHandler.CheckAppleDocFreshness(AppleDocHandler.IosAtomFeed, out infos); if (!docOutdated) { mergeOutdated = AppleDocHandler.CheckMergedDocumentationFreshness(infos); } return(Tuple.Create(docOutdated || mergeOutdated, docOutdated, mergeOutdated)); }).ContinueWith(t => { Console.WriteLine("Merged status {0}", t.Result); if (!t.Result.Item1) { return; } BeginInvokeOnMainThread(() => LaunchDocumentationUpdate(t.Result.Item2, t.Result.Item3)); }); } }
public AppDelegate() { PrepareCache(); ExtractImages(); controller = new MonodocDocumentController(); // Some UI feature we use rely on Lion, so special case it try { var version = new NSDictionary("/System/Library/CoreServices/SystemVersion.plist"); isOnLion = version.ObjectForKey(new NSString("ProductVersion")).ToString().StartsWith("10.7"); } catch {} // Load documentation var args = Environment.GetCommandLineArgs(); IEnumerable <string> extraDocs = null, extraUncompiledDocs = null; if (args != null && args.Length > 1) { var extraDirs = args.Skip(1); extraDocs = extraDirs .Where(d => d.StartsWith("+")) .Select(d => d.Substring(1)) .Where(d => Directory.Exists(d)); extraUncompiledDocs = extraDirs .Where(d => d.StartsWith("@")) .Select(d => d.Substring(1)) .Where(d => Directory.Exists(d)); } if (extraUncompiledDocs != null) { foreach (var dir in extraUncompiledDocs) { RootTree.UncompiledHelpSources.Add(dir); } } Root = RootTree.LoadTree(null); if (extraDocs != null) { foreach (var dir in extraDocs) { Root.AddSource(dir); } } var macDocPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "macdoc"); if (!Directory.Exists(macDocPath)) { Directory.CreateDirectory(macDocPath); } var helpSources = Root.HelpSources .Cast <HelpSource> () .Where(hs => !string.IsNullOrEmpty(hs.BaseFilePath) && !string.IsNullOrEmpty(hs.Name)) .Select(hs => Path.Combine(hs.BaseFilePath, hs.Name + ".zip")) .Where(File.Exists); IndexUpdateManager = new IndexUpdateManager(helpSources, macDocPath); BookmarkManager = new BookmarkManager(macDocPath); AppleDocHandler = new AppleDocHandler("/Library/Frameworks/Mono.framework/Versions/Current/etc/"); // Configure the documentation rendering. SettingsHandler.Settings.EnableEditing = false; SettingsHandler.Settings.preferred_font_size = 200; HelpSource.use_css = true; }
public AppDelegate () { PrepareCache (); ExtractImages (); controller = new MonodocDocumentController (); // Some UI feature we use rely on Lion or better, so special case it try { var version = new NSDictionary ("/System/Library/CoreServices/SystemVersion.plist"); var osxVersion = Version.Parse (version.ObjectForKey (new NSString ("ProductVersion")).ToString ()); isOnLion = osxVersion.Major == 10 && osxVersion.Minor >= 7; } catch {} // Load documentation var args = Environment.GetCommandLineArgs (); IEnumerable<string> extraDocs = null, extraUncompiledDocs = null; if (args != null && args.Length > 1) { var extraDirs = args.Skip (1); extraDocs = extraDirs .Where (d => d.StartsWith ("+")) .Select (d => d.Substring (1)) .Where (d => Directory.Exists (d)); extraUncompiledDocs = extraDirs .Where (d => d.StartsWith ("@")) .Select (d => d.Substring (1)) .Where (d => Directory.Exists (d)); } if (extraUncompiledDocs != null) foreach (var dir in extraUncompiledDocs) RootTree.UncompiledHelpSources.Add (dir); Root = RootTree.LoadTree (null); if (extraDocs != null) foreach (var dir in extraDocs) Root.AddSource (dir); var macDocPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "macdoc"); if (!Directory.Exists (macDocPath)) Directory.CreateDirectory (macDocPath); var helpSources = Root.HelpSources .Cast<HelpSource> () .Where (hs => !string.IsNullOrEmpty (hs.BaseFilePath) && !string.IsNullOrEmpty (hs.Name)) .Select (hs => Path.Combine (hs.BaseFilePath, hs.Name + ".zip")) .Where (File.Exists); IndexUpdateManager = new IndexUpdateManager (helpSources, macDocPath); BookmarkManager = new BookmarkManager (macDocPath); AppleDocHandler = new AppleDocHandler ("/Library/Frameworks/Mono.framework/Versions/Current/etc/"); // Configure the documentation rendering. SettingsHandler.Settings.EnableEditing = false; SettingsHandler.Settings.preferred_font_size = 200; HelpSource.use_css = true; }
public override void FinishedLaunching(NSObject notification) { // Check if we are loaded with a search term and load a document for it var args = Environment.GetCommandLineArgs(); NSError error; var searchArgIdx = Array.IndexOf <string> (args, "--search"); if (searchArgIdx != -1 && args.Length > searchArgIdx + 1 && !string.IsNullOrEmpty(args [searchArgIdx + 1])) { var document = controller.OpenUntitledDocument(true, out error); if (document != null) { ((MyDocument)document).LoadWithSearch(args[searchArgIdx + 1]); } } var indexManager = IndexUpdateManager; indexManager.CheckIndexIsFresh().ContinueWith(t => { if (t.IsFaulted) { Logger.LogError("Error while checking indexes", t.Exception); } else if (!t.Result) { indexManager.PerformSearchIndexCreation(); } else { indexManager.AdvertiseFreshIndex(); } }).ContinueWith(t => Logger.LogError("Error while creating indexes", t.Exception), TaskContinuationOptions.OnlyOnFaulted); // Check if there is a MonoTouch/MonoMac documentation installed and launch accordingly var products = Root.HelpSources.Where(hs => hs != null && hs.Name != null).ToProducts().Distinct().ToArray(); if (products.Where(p => File.Exists(ProductUtils.GetMergeToolForProduct(p))).Any()) { Task.Factory.StartNew(() => { return(products.ToDictionary(p => p, p => { AppleDocHandler.AppleDocInformation infos; bool mergeOutdated = false; bool docOutdated = AppleDocHandler.CheckAppleDocFreshness(ProductUtils.GetDocFeedForProduct(p), out infos); if (!docOutdated) { mergeOutdated = AppleDocHandler.CheckMergedDocumentationFreshness(infos, p); } return Tuple.Create(docOutdated, mergeOutdated); })); }).ContinueWith(t => { Logger.Log("Merged status {0}", string.Join(", ", t.Result.Select(kvp => kvp.ToString()))); if (!t.Result.Any(kvp => kvp.Value.Item1 || kvp.Value.Item2)) { return; } BeginInvokeOnMainThread(() => LaunchDocumentationUpdate(t.Result)); }); } }
// Call to load from the XIB/NIB file public AppleDocWizardController() : base("AppleDocWizard") { Window.CancellationSource = source; handler = new AppleDocHandler(ConfigDir); handler.AppleDocProgress += HandleAppleDocProgress; }
// Call to load from the XIB/NIB file public AppleDocWizardController () : base ("AppleDocWizard") { Window.CancellationSource = source; handler = new AppleDocHandler (ConfigDir); handler.AppleDocProgress += HandleAppleDocProgress; }