예제 #1
0
        private void Open(FileChooserAction action)
        {
            string title = Catalog.GetString("Open");

            if (action == FileChooserAction.SelectFolder)
            {
                title = Catalog.GetString("Select Folder");
            }

            FileChooserDialog chooser = new FileChooserDialog(title,
                                                              window,
                                                              action);

            chooser.AddButton(Stock.Cancel, ResponseType.Cancel);
            chooser.AddButton(Stock.Open, ResponseType.Ok);

            chooser.SetUri(uri.ToString());
            int response = chooser.Run();

            if ((ResponseType)response == ResponseType.Ok)
            {
                CurrentUri = new System.Uri(chooser.Uri);
            }


            chooser.Destroy();
        }
예제 #2
0
        void Open(FileChooserAction action)
        {
            string title = Strings.Open;

            if (action == FileChooserAction.SelectFolder)
            {
                title = Strings.SelectFolder;
            }

            var chooser = new FileChooserDialog(title,
                                                Window,
                                                action);

            chooser.AddButton(Stock.Cancel, ResponseType.Cancel);
            chooser.AddButton(Stock.Open, ResponseType.Ok);

            chooser.SetUri(uri.ToString());
            int response = chooser.Run();

            if ((ResponseType)response == ResponseType.Ok)
            {
                CurrentUri = new Uri(chooser.Uri, true);
            }


            chooser.Destroy();
        }
예제 #3
0
        private void HandleFileOpen(object sender, System.EventArgs args)
        {
            string open = null;

            FileChooserDialog file_selector =
                new FileChooserDialog("Open", this.Window,
                                      FileChooserAction.Open);

            file_selector.SetUri(uri.ToString());
            int response = file_selector.Run();

            if ((Gtk.ResponseType)response == Gtk.ResponseType.Ok)
            {
                open = file_selector.Filename;
                new FSpot.SingleView(open);
            }

            file_selector.Destroy();
        }
예제 #4
0
        void HandleFileOpen(object sender, EventArgs args)
        {
            var file_selector = new FileChooserDialog("Open", Window, FileChooserAction.Open);

            file_selector.SetUri(uri.ToString());
            int response = file_selector.Run();

            if ((Gtk.ResponseType)response == Gtk.ResponseType.Ok)
            {
                var l = new List <Uri> ();
                foreach (var s in file_selector.Uris)
                {
                    l.Add(new Uri(s));
                }
                new SingleView(l.ToArray());
            }

            file_selector.Destroy();
        }
예제 #5
0
        public bool OpenSaveFilePicker(string fileName, out string filePath)
        {
            filePath = string.Empty;
            FileChooserDialog Chooser = new FileChooserDialog
                                        (
                "Укажите файл для сохранения",
                null,
                FileChooserAction.Save,
                "Отмена", ResponseType.Cancel,
                "Загрузить", ResponseType.Accept
                                        );

            Chooser.SetUri(fileName);

            if (MIMEFilters?.Any() ?? false)
            {
                FileFilter filter = new FileFilter();

                foreach (var item in MIMEFilters)
                {
                    filter.AddMimeType(item);
                }

                Chooser.AddFilter(filter);
            }

            if ((ResponseType)Chooser.Run() == ResponseType.Accept)
            {
                Chooser.Hide();
                filePath = Chooser.Filename;
            }

            Chooser.Destroy();
            MIMEFilters = null;

            return(!String.IsNullOrWhiteSpace(filePath));
        }