Exemplo n.º 1
0
		static StorageDeviceHelper ()
		{
			if (fileManager == null) {

				// Because this will run in a background thread we need to wrap it
				using (var p = new NSAutoreleasePool ()) {
					fileManager = NSFileManager.DefaultManager;
					attributes = fileManager.GetFileSystemAttributes(path, out error);
				}					
			}
		}
Exemplo n.º 2
0
        string CreateAppDirectory(NSSearchPathDirectory targetDir, string subDir = "BlobCache")
        {
            NSError err;

            var fm = new NSFileManager();
            var url = fm.GetUrl(targetDir, NSSearchPathDomain.All, null, true, out err);
            var ret = Path.Combine(url.RelativePath, BlobCache.ApplicationName, subDir);
            if (!Directory.Exists(ret)) _inner.CreateRecursive(ret).Wait();

            return ret;
        }
Exemplo n.º 3
0
        public override void FinishedLaunching(NSObject notification)
        {
            var urlList = new NSFileManager().GetUrls(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User);

            Preferences.Load(Path.Combine(
                urlList[0].Path,
                "Preferences",
                "com.rangic.MapThis.json"));

            Rangic.Utilities.Geo.OpenStreetMapLookupProvider.UrlBaseAddress = Preferences.Instance.BaseLocationLookup;
            logger.Info("Resolving placenames via {0}", Rangic.Utilities.Geo.OpenStreetMapLookupProvider.UrlBaseAddress);

            mainWindowController = new MainWindowController();
            mainWindowController.Window.MakeKeyAndOrderFront(this);
        }
Exemplo n.º 4
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            Environment.SetEnvironmentVariable("MONO_MANAGED_WATCHER", "enabled");
            var urlList = new NSFileManager().GetUrls(NSSearchPathDirectory.LibraryDirectory, NSSearchPathDomain.User);
            Preferences<RadishPreferences>.Load(Path.Combine(
                urlList[0].Path,
                "Preferences",
                "Radish.rangic.json"));
            
            Rangic.Utilities.Geo.OpenStreetMapLookupProvider.UrlBaseAddress = Preferences<RadishPreferences>.Instance.BaseLocationLookup;
            logger.Info("Resolving placenames via {0}", Rangic.Utilities.Geo.OpenStreetMapLookupProvider.UrlBaseAddress);

			controller = new MainWindowController();
			controller.Window.MakeKeyAndOrderFront(this);

            if (filename != null)
            {
                controller.OpenFolderOrFile(filename);
            }
		}
Exemplo n.º 5
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            InitializeImageFilters();
            MapWebView.MainFrame.LoadRequest(new NSUrlRequest(new NSUrl(NSBundle.MainBundle.PathForResource("map", "html"))));
            searchField.Delegate = new SearchTextFieldDelegate(this);
            Window.Delegate = new MainWindowDelegate(this);
            tabSplitView.Delegate = new SplitViewDelegate(this);

            imageView.SetValueForKey(NSColor.DarkGray, IKImageBrowserView.BackgroundColorKey);
            var oldAttrs = imageView.ValueForKey(IKImageBrowserView.CellsTitleAttributesKey);
            var newAttrs = oldAttrs.MutableCopy();
            newAttrs.SetValueForKey(NSColor.White, NSAttributedString.ForegroundColorAttributeName);
            imageView.SetValueForKey(newAttrs, IKImageBrowserView.CellsTitleAttributesKey);
            imageView.SetValueForKey(newAttrs, IKImageBrowserView.CellsSubtitleAttributesKey);

            keywordEntry.Changed += delegate(object sender, EventArgs args) { KeywordsTextChanged((NSNotification) sender); };
            keywordEntry.DoCommandBySelector += KeywordsCommandSelector;
            keywordEntry.GetCompletions += KeywordsGetCompletions;
            keywordEntry.EditingEnded += delegate(object sender, EventArgs e) { ApplyKeyword(); };

            imageFilterSelector.SelectItem(Preferences.Instance.ImageFilterIndex);
            imageTypes = imageFilters[Preferences.Instance.ImageFilterIndex].Types;

            if (Preferences.Instance.LastOpenedFolder != null)
            {
                directoryTree = new DirectoryTree(Preferences.Instance.LastOpenedFolder);
            }
            else
            {
                var urlList = new NSFileManager().GetUrls(NSSearchPathDirectory.PicturesDirectory, NSSearchPathDomain.User);
                directoryTree = new DirectoryTree(urlList[0].Path);
            }

            var selectedPath = Preferences.Instance.LastSelectedFolder;
            if (!String.IsNullOrEmpty(selectedPath))
            {
                int bestRow = -1;
                for (int row = 0; row < directoryView.RowCount; ++row)
                {
                    var dt = directoryView.ItemAtRow(row) as DirectoryTree;
                    if (dt.Path == selectedPath)
                    {
                        bestRow = row;
                        break;
                    }

                    if (selectedPath.StartsWith(dt.Path))
                    {
                        bestRow = row;
                    }
                }

                if (bestRow >= 0)
                {
                    directoryView.SelectRow(bestRow, false);
                }
            }

            MapWebView.CompleteDropAction = CompleteDrop;
        }