예제 #1
0
        protected override bool RunDefault()
        {
            var win = new FileSelectorDialog(Title, Action);

            win.SeletcedEncoding     = Encoding != null ? Encoding.CodePage : 0;
            win.ShowEncodingSelector = ShowEncodingSelector;
            win.ShowViewerSelector   = ShowViewerSelector;

            SetDefaultProperties(win);

            try
            {
                var result = MessageService.RunCustomDialog(win, TransientFor ?? MessageService.RootWindow);
                if (result == (int)Gtk.ResponseType.Ok)
                {
                    GetDefaultProperties(win);
                    data.Encoding = win.SeletcedEncoding > 0 ? Encoding.GetEncoding(win.SeletcedEncoding) : null;
                    data.CloseCurrentWorkspace = win.CloseCurrentWorkspace;
                    data.SelectedViewer        = win.SelectedViewer;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            finally
            {
                win.Destroy();
            }
        }
예제 #2
0
        bool RunDefault()
        {
            var win = new FileSelectorDialog(Title, Action);

            win.Encoding             = Encoding;
            win.ShowEncodingSelector = ShowEncodingSelector;
            win.ShowViewerSelector   = ShowViewerSelector;

            //FIXME: should these be optional? they were hardcoded into the dialog - at least they're factored out now
            AddDefaultFileFilters();
            LoadDefaultFilter();

            SetDefaultProperties(win);

            try {
                var result = MessageService.RunCustomDialog(win, TransientFor ?? MessageService.RootWindow);
                if (result == (int)Gtk.ResponseType.Ok)
                {
                    GetDefaultProperties(win);
                    data.Encoding = win.Encoding;
                    data.CloseCurrentWorkspace = win.CloseCurrentWorkspace;
                    data.SelectedViewer        = win.SelectedViewer;
                    SaveDefaultFilter();
                    return(true);
                }
                else
                {
                    return(false);
                }
            } finally {
                win.Destroy();
            }
        }
예제 #3
0
        protected override bool RunDefault()
        {
            var win = new FileSelectorDialog(Title, Action.ToGtkAction());

            win.SelectedEncoding     = Encoding != null ? Encoding.CodePage : 0;
            win.ShowEncodingSelector = ShowEncodingSelector;
            win.ShowViewerSelector   = ShowViewerSelector;
            bool pathAlreadySet = false;

            win.CurrentFolderChanged += (s, e) => {
                var selectedPath = data.OnDirectoryChanged(this, win.CurrentFolder);
                if (selectedPath.IsNull)
                {
                    return;
                }
                data.SelectedFiles = new FilePath [] { selectedPath };
                pathAlreadySet     = true;
                win.Respond(Gtk.ResponseType.Cancel);
            };

            SetDefaultProperties(win);

            try {
                var result = MessageService.RunCustomDialog(win, TransientFor ?? MessageService.RootWindow);
                if (result == (int)Gtk.ResponseType.Ok)
                {
                    GetDefaultProperties(win);
                    data.Encoding = win.SelectedEncoding > 0 ? Encoding.GetEncoding(win.SelectedEncoding) : null;
                    data.CloseCurrentWorkspace = win.CloseCurrentWorkspace;
                    data.SelectedViewer        = win.SelectedViewer;
                    return(true);
                }
                else
                {
                    return(pathAlreadySet);
                }
            } finally {
                win.Destroy();
                win.Dispose();
            }
        }
		protected override void Run ()
		{
			var selector = new FileSelectorDialog ("Open session");
			string filename = null;
			try {
				var result = MessageService.RunCustomDialog (selector, MessageService.RootWindow);

				if (result == (int)Gtk.ResponseType.Cancel) {
					return;
				}

				filename = selector.Filename;
			} finally {
				selector.Destroy ();
			}
			AutoTestService.ReplaySessionFromFile (filename);
		}
		protected override void Run ()
		{
			if (AutoTestService.CurrentRecordSession == null) {
				AutoTestService.StartRecordingSession ();
			} else {
				var selector = new FileSelectorDialog ("Save session as...", Gtk.FileChooserAction.Save);
				try {
					var result = MessageService.RunCustomDialog (selector, MessageService.RootWindow);

					if (result == (int)Gtk.ResponseType.Cancel) {
						return;
					}

					AutoTestService.StopRecordingSession (selector.Filename);
				} finally {
					selector.Destroy ();
				}
			}
		}