コード例 #1
0
 protected virtual void OnResponse(object o, Gtk.ResponseArgs args)
 {
     if (args.ResponseId.Equals(Gtk.ResponseType.DeleteEvent))
     {
         this.dlgAddEvent.Respond(ResponseType.Close);
     }
 }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: ncjones/AddressBookDemo
 void ContactDialogResponseHandler(object o, ResponseArgs args, ContactHandler contactHandler)
 {
     var dialog = (ContactDialog)o;
     if (args.ResponseId.Equals(ResponseType.Ok)) {
         contactHandler(dialog.GetContact());
     }
     dialog.Hide();
 }
コード例 #3
0
ファイル: ReportGUI.cs プロジェクト: TheProjecter/zaspe-sharp
 protected virtual void OnResponse(object o, Gtk.ResponseArgs args)
 {
     if (args.ResponseId.Equals(Gtk.ResponseType.DeleteEvent) ||
         args.ResponseId.Equals(Gtk.ResponseType.Close))
     {
         this.Destroy();
     }
 }
コード例 #4
0
 void OnResponse(object ob, Gtk.ResponseArgs args)
 {
     dialog.Response -= new Gtk.ResponseHandler(OnResponse);
     if (args.ResponseId == ResponseType.Ok && radioCreate.Active)
     {
         lastNamespace = Namespace;
     }
 }
コード例 #5
0
ファイル: SmugMugExport.cs プロジェクト: anil-ku-in/luminous
 protected void HandleAddResponse(object sender, Gtk.ResponseArgs args)
 {
     if (args.ResponseId == Gtk.ResponseType.Ok)
     {
         smugmug.CreateAlbum(title, CurrentCategoryId, public_check.Active);
         export.HandleAlbumAdded(title);
     }
     Dialog.Destroy();
 }
コード例 #6
0
		void HandleResponse (object obj, ResponseArgs args)
	        {
			switch(args.ResponseId)
			{
				case ResponseType.Close:
					this.Destroy ();
					break;
			}
	        }
コード例 #7
0
ファイル: SmugMugExport.cs プロジェクト: anil-ku-in/luminous
 protected void HandleAddResponse(object sender, Gtk.ResponseArgs args)
 {
     if (args.ResponseId == Gtk.ResponseType.Ok)
     {
         SmugMugAccount account = new SmugMugAccount(username, password);
         SmugMugAccountManager.GetInstance().AddAccount(account);
     }
     Dialog.Destroy();
 }
コード例 #8
0
 protected virtual void OnResponse(object o, Gtk.ResponseArgs args)
 {
     Gtk.TreeModel foo;
     Gtk.TreeIter  iter;
     if (!list.Selection.GetSelected(out foo, out iter))
     {
         return;
     }
     pid = (int)store.GetValue(iter, 2);
 }
コード例 #9
0
        void OnDialogResponse(object o, Gtk.ResponseArgs args)
        {
            // If the widget is not removed we can not show it again
            // at a later invocation of PreferencesDialog
            if (PreferencesPaned.Child2 != null)
            {
                PreferencesPaned.Remove(PreferencesPaned.Child2);
            }

            this.Destroy();
        }
コード例 #10
0
 public void OnWindowResponse(object o, ResponseArgs args)
 {
     switch ((int) args.ResponseId) {
         case (int) ResponseType.DeleteEvent:
         case (int) ResponseType.Cancel:
         case (int) ResponseType.Close:
            	window.Visible = false;
            	break;
         default:
             break;
     }
 }
コード例 #11
0
        protected virtual void OnResponse(object o, Gtk.ResponseArgs args)
        {
            switch (args.ResponseId)
            {
            case Gtk.ResponseType.Ok:
                MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text);
                break;

            case Gtk.ResponseType.Cancel:
                break;
            }
            this.Hide();
        }
コード例 #12
0
		private void on_dialog_response (object sender, ResponseArgs args) {
			if (args.ResponseId != Gtk.ResponseType.Ok) {
				// FIXME this is to work around a bug in gtk+ where
				// the filesystem events are still listened to when
				// a FileChooserButton is destroyed but not finalized
				// and an event comes in that wants to update the child widgets.
				uri_chooser.Dispose ();
				uri_chooser = null;
			} else if (args.ResponseId == Gtk.ResponseType.Ok) {
				zip ();
			}
			zipdiag.Destroy ();
		}
コード例 #13
0
        protected void HandleResponse(object o, Gtk.ResponseArgs args)
        {
            if (args.ResponseId == ResponseType.Ok)
            {
                Roll [] selected_rolls = SelectedRolls();

                if (selected_rolls.Length > 0)
                {
                    query.RollSet = new RollSet(selected_rolls);
                }
            }
            Dialog.Destroy();
        }
コード例 #14
0
ファイル: StatisticsPlugin.cs プロジェクト: switsys/bless
        void OnDialogResponse(object o, Gtk.ResponseArgs args)
        {
            dataBook.SwitchPage -= new SwitchPageHandler(OnSwitchPage);
            dataBook.PageAdded  -= new DataView.DataViewEventHandler(OnDataViewAdded);
            dataBook.Removed    -= new RemovedHandler(OnDataViewRemoved);

            foreach (DataViewDisplay dvd in dataBook.Children)
            {
                dvd.View.Buffer.Changed -= new ByteBuffer.ChangedHandler(OnBufferContentsChanged);
                dvd.View.BufferChanged  -= new DataView.DataViewEventHandler(OnBufferChanged);
            }

            this.Destroy();
        }
コード例 #15
0
ファイル: SmugMugExport.cs プロジェクト: anil-ku-in/luminous
 protected void HandleEditResponse(object sender, Gtk.ResponseArgs args)
 {
     if (args.ResponseId == Gtk.ResponseType.Ok)
     {
         account.Username = username;
         account.Password = password;
         SmugMugAccountManager.GetInstance().MarkChanged(true, account);
     }
     else if (args.ResponseId == Gtk.ResponseType.Reject)
     {
         // NOTE we are using Reject to signal the remove action.
         SmugMugAccountManager.GetInstance().RemoveAccount(account);
     }
     Dialog.Destroy();
 }
コード例 #16
0
		protected void OnRespond (object o, ResponseArgs args)
		{
			if (args.ResponseId != Gtk.ResponseType.Ok)
				return;
				
			TreeIter iter;
			var list = new List<int> ();
			if (storeSelected.GetIterFirst (out iter)) {
				do {
					var enc = (int)storeSelected.GetValue (iter, 2);
					list.Add (enc);
				} while (storeSelected.IterNext (ref iter));
			}
			TextEncoding.ConversionEncodings = list.Select (TextEncoding.GetEncoding).ToArray ();
		}
コード例 #17
0
        void OnDialogResponse(object o, Gtk.ResponseArgs args)
        {
            if (args.ResponseId == ResponseType.Ok && selectedLayout != null)
            {
                // get current dataview
                if (dataBook != null && dataBook.NPages > 0)
                {
                    DataView dv = ((DataViewDisplay)dataBook.CurrentPageWidget).View;
                    dv.Display.Layout = new Layout(selectedLayout);
                }
            }

            // dispose preview Area pixmaps
            dataPreview.Cleanup();

            this.Destroy();
        }
コード例 #18
0
		protected void OnRespond (object o, ResponseArgs args)
		{
			if (args.ResponseId != Gtk.ResponseType.Ok)
				return;
				
			TreeIter iter;
			ArrayList list = new ArrayList ();
			if (storeSelected.GetIterFirst (out iter)) {
				do {
					string id = (string) storeSelected.GetValue (iter, 1);
					TextEncoding enc = TextEncoding.GetEncoding (id);
					list.Add (enc);
				}
				while (storeSelected.IterNext (ref iter));
			}
			TextEncoding.ConversionEncodings = (TextEncoding[]) list.ToArray (typeof(TextEncoding));
		}
コード例 #19
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                Dialog.Destroy();
                return;
            }

            if (account != null)
            {
                Dialog.Hide();

                command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString("Uploading Pictures");

                progress_dialog = new FSpot.ThreadProgressDialog(command_thread, items.Length);
                progress_dialog.Start();
            }
        }
コード例 #20
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            bool destroy_dialog = false;

            ChangePhotoPath.ProcessResult tmp_res;
            if (args.ResponseId == Gtk.ResponseType.Ok)
            {
                tmp_res = contr.ChangePathOnPhotos(old_common_uri.Text, new_common_uri.Text);
                switch (tmp_res)
                {
                case ProcessResult.Ok:       DisplayExecutionOkMsg();
                    destroy_dialog = true;
                    break;

                case ProcessResult.Cancelled:       DisplayCancelledMsg();
                    break;

                case ProcessResult.Error:       DisplayExecutionNotOkMsg();
                    break;

                case ProcessResult.SamePath:       DisplaySamePathMsg();
                    break;

                case ProcessResult.NoPhotosFound:       DisplayNoPhotosFoundMsg();
                    break;

                case ProcessResult.Processing:       System.Console.WriteLine("processing");
                    break;
                }
            }
            else
            {
                destroy_dialog = true;
            }

            remove_progress_dialog();
            if (destroy_dialog)
            {
                Dialog.Destroy();
            }

            return;
        }
コード例 #21
0
ファイル: SmugMugExport.cs プロジェクト: anil-ku-in/luminous
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                Dialog.Destroy();
                return;
            }

            if (scale_check != null)
            {
                scale = scale_check.Active;
                size  = size_spin.ValueAsInt;
            }
            else
            {
                scale = false;
            }

            browser = browser_check.Active;
            rotate  = rotate_check.Active;
//                      meta = meta_check.Active;

            if (account != null)
            {
                //System.Console.WriteLine ("history = {0}", album_optionmenu.History);
                album       = (Album)account.SmugMug.GetAlbums() [Math.Max(0, album_optionmenu.History)];
                photo_index = 0;

                Dialog.Destroy();

                command_thread      = new System.Threading.Thread(new System.Threading.ThreadStart(this.Upload));
                command_thread.Name = Mono.Unix.Catalog.GetString("Uploading Pictures");

                progress_dialog = new FSpot.ThreadProgressDialog(command_thread, items.Length);
                progress_dialog.Start();

                // Save these settings for next time
                Preferences.Set(Preferences.EXPORT_SMUGMUG_SCALE, scale);
                Preferences.Set(Preferences.EXPORT_SMUGMUG_SIZE, size);
                Preferences.Set(Preferences.EXPORT_SMUGMUG_ROTATE, rotate);
                Preferences.Set(Preferences.EXPORT_SMUGMUG_BROWSER, browser);
            }
        }
コード例 #22
0
ファイル: ConfigDlg.cs プロジェクト: BackupTheBerlios/tamjb
      void _OnResponse( object o, ResponseArgs args )
      {
         switch (args.ResponseId)
         {
         case ResponseType.Ok:         // save
            Trace.WriteLine( "ConfigDlg: Ok" );
            bool convertOk = false;
            int port = 0;
            try
            {
               port = Convert.ToInt32( _serverPort.Text );
               convertOk = true;
            }
            catch (Exception e)
            {
               // I think we should prevent all invalid entry rather
               // than catching it here after the fact.
               Trace.WriteLine( "Invalid port - " + e.ToString() );
            }
            
            if (convertOk)
            {
               _settings.serverName = _serverName.Text;
               _settings.serverPort = port;
               Hide();
            }

            break;
            
         case ResponseType.Cancel:
            // Restore previous values to controls
            _serverName.Text = _settings.serverName;
            _serverPort.Text = _settings.serverPort.ToString();
            Hide();
            break;
            
         default:
            Trace.WriteLine( "ConfigDlg: Unexpected Response" );
            break;
         }
      }
コード例 #23
0
		//Disabling warning 0169 because this code will be called at
		//runtime with glade.
		#pragma warning disable 0169
		private void OnDialogResponse (object sender, ResponseArgs args) 
		{
			if (args.ResponseId == ResponseType.Ok) {
				MeasureFinder measureFinder = new MeasureFinder ();
				int minimumValue = Int32.Parse (minimumValueEntry.Text);
				if (linesPerMethodRadioButton.Active) {
					results = measureFinder.FindByLinesPerMethod (measures, minimumValue);
				}
				else if (parametersPerMethodRadioButton.Active) {
					results = measureFinder.FindByParametersPerMethod (measures, minimumValue);
				}
				else if (numberOfLinesRadioButton.Active) {
					results = measureFinder.FindByNumberOfLines (measures, minimumValue);
				}
				else if (numberOfParametersRadioButton.Active) {
					results = measureFinder.FindByNumberOfParameters (measures, minimumValue);
				}
				else if (numberOfFieldsRadioButton.Active) {
					results = measureFinder.FindByNumberOfFields (measures, minimumValue);
				}
			}
			findDialog.Destroy ();
		}
コード例 #24
0
 private void OnResponse(object sender, ResponseArgs args)
 {
     (sender as Dialog).Response -= OnResponse;
     (sender as Dialog).Destroy();
 }
コード例 #25
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            long new_size = 0;
//			long orig_size = 0;
            long actual_total_size = 0;
            int  size = 0;

            System.IO.FileInfo file_info;
            bool UserCancelled = false;
            bool rotate        = true;

            // Lets remove the mail "create mail" dialog
            Dialog.Destroy();

            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                return;
            }
            ProgressDialog progress_dialog = null;

            actual_total_size = 0;

            progress_dialog = new ProgressDialog(Catalog.GetString("Preparing email"),
                                                 ProgressDialog.CancelButtonType.Stop,
                                                 selection.Items.Length,
                                                 parent_window);

            size = GetScaleSize();             // Which size should we scale to. 0 --> Original

            // evaluate mailto command and define attachment args for cli
            System.Text.StringBuilder attach_arg = new System.Text.StringBuilder();
            switch (Preferences.Get(Preferences.GNOME_MAILTO_COMMAND) as string)
            {
            case "thunderbird %s":
            case "mozilla-thunderbird %s":
            case "seamonkey -mail -compose %s":
            case "icedove %s":
                attach_arg.Append(",");
                break;

            case "kmail %s":
                attach_arg.Append(" --attach ");
                break;

            default:                      //evolution falls into default, since it supports mailto uri correctly
                attach_arg.Append("&attach=");
                break;
            }

            rotate = rotate_check.Active;              // Should we automatically rotate original photos.
            Preferences.Set(Preferences.EXPORT_EMAIL_ROTATE, rotate);

            // Initiate storage for temporary files to be deleted later
            tmp_paths = new System.Collections.ArrayList();

            // Create a tmp directory.
            tmp_mail_dir = System.IO.Path.GetTempFileName();                    // Create a tmp file
            System.IO.File.Delete(tmp_mail_dir);                                // Delete above tmp file
            System.IO.Directory.CreateDirectory(tmp_mail_dir);                  // Create a directory with above tmp name

            System.Text.StringBuilder mail_attach = new System.Text.StringBuilder();

            FilterSet filters = new FilterSet();

            if (size != 0)
            {
                filters.Add(new ResizeFilter((uint)size));
            }
            else if (rotate)
            {
                filters.Add(new OrientationFilter());
            }
            filters.Add(new UniqueNameFilter(tmp_mail_dir));


            foreach (Photo photo in selection.Items)
            {
                if ((photo != null) && (!UserCancelled))
                {
                    if (progress_dialog != null)
                    {
                        UserCancelled = progress_dialog.Update(String.Format
                                                                   (Catalog.GetString("Exporting picture \"{0}\""), photo.Name));
                    }

                    if (UserCancelled)
                    {
                        break;
                    }

                    file_info = new System.IO.FileInfo(photo.GetVersionPath(photo.DefaultVersionId));
//					orig_size = file_info.Length;

                    // Prepare a tmp_mail file name
                    FilterRequest request = new FilterRequest(photo.DefaultVersionUri);

                    filters.Convert(request);
                    request.Preserve(request.Current);

                    mail_attach.Append(attach_arg.ToString() + System.Web.HttpUtility.UrlEncode(request.Current.ToString()));

                    // Mark the path for deletion
                    tmp_paths.Add(request.Current.LocalPath);

                    // Update the running total of the actual file sizes.
                    file_info          = new System.IO.FileInfo(request.Current.LocalPath);
                    new_size           = file_info.Length;
                    actual_total_size += new_size;

                    // Update dialog to indicate Actual size!
                    // This is currently disabled, since the dialog box is not visible at this stage.
                    // string approxresult = SizeUtil.ToHumanReadable (actual_total_size);
                    // ActualMailSize.Text = approxresult;


                    //System.Console.WriteLine ("Orig file size {0}, New file size {1}, % {4}, Scaled to size {2}, new name {3}",
                    //orig_size, new_size, size, tmp_path, 1 - ((orig_size-new_size)/orig_size));
                }
            }             // foreach

            if (progress_dialog != null)
            {
                progress_dialog.Destroy();                  // No need to keep this window
            }
            if (UserCancelled)
            {
                DeleteTempFile();
            }
            else
            {
                // Send the mail :)
                switch (Preferences.Get(Preferences.GNOME_MAILTO_COMMAND) as string)
                {
                // openSuSE
                case "thunderbird %s":
                    System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=my photos,attachment='" + mail_attach + "'\"");
                    break;

                case "icedove %s":
                    System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=my photos,attachment='" + mail_attach + "'\"");
                    break;

                case "mozilla-thunderbird %s":
                    System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=my photos,attachment='" + mail_attach + "'\"");
                    break;

                case "seamonkey -mail -compose %s":
                    System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=my photos,attachment='" + mail_attach + "'\"");
                    break;

                case "kmail %s":
                    System.Diagnostics.Process.Start("kmail", "  --composer --subject \"my photos\"" + mail_attach);
                    break;

                default:
                    GnomeUtil.UrlShow(parent_window, "mailto:?subject=my%20photos" + mail_attach);
                    break;
                }

                // Check if we have any temporary files to be deleted
                if (tmp_paths.Count > 0)
                {
                    // Fetch timeout value from preferences. In seconds. Needs to be multiplied with 1000 to get msec
                    uint delete_timeout;
                    delete_timeout = (uint)((int)Preferences.Get(Preferences.EXPORT_EMAIL_DELETE_TIMEOUT_SEC));
                    delete_timeout = delete_timeout * 1000;                     // to get milliseconds.

                    // Start a timer and when it occurs, delete the temp files.
                    GLib.Timeout.Add(delete_timeout, new GLib.TimeoutHandler(DeleteTempFile));
                }
            }
        }
コード例 #26
0
 private void OnConflictDialogResponse(object o, ResponseArgs args)
 {
     iFolderConflictDialog conflictDialog = (iFolderConflictDialog) o;
        if (args.ResponseId == ResponseType.Help)
     Util.ShowHelp("conflicts.html", this);
        else
        {
     if (conflictDialog != null)
     {
      conflictDialog.Hide();
      conflictDialog.Destroy();
      if (ConflictDialogs.ContainsKey(conflictDialog.iFolder.ID))
       ConflictDialogs.Remove(conflictDialog.iFolder.ID);
      conflictDialog = null;
     }
        }
 }
コード例 #27
0
 private void OnDialogResponse(object o, ResponseArgs args)
 {
     if (domainController != null)
        {
     domainController.DomainHostModified -=
      new DomainHostModifiedEventHandler(OnDomainHostModified);
     domainController.DomainLoggedIn -=
      new DomainLoggedInEventHandler(OnDomainLoggedIn);
     domainController.DomainLoggedOut -=
      new DomainLoggedOutEventHandler(OnDomainLoggedOut);
     domainController.DomainActivated -=
      new DomainActivatedEventHandler(OnDomainActivated);
     domainController.DomainInactivated -=
      new DomainInactivatedEventHandler(OnDomainInactivated);
     domainController.NewDefaultDomain -=
      new DomainNewDefaultEventHandler(OnNewDefaultDomain);
     domainController.DomainDeleted -=
      new DomainDeletedEventHandler(OnDomainDeleted);
        }
 }
コード例 #28
0
ファイル: FlickrExport.cs プロジェクト: f-spot/f-spot-xplat
        void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                if (command_thread != null && command_thread.IsAlive)
                {
                    command_thread.Abort();
                }

                Dialog.Destroy();
                return;
            }

            if (fr.CheckLogin(oauth_verification_code.Text) == null)
            {
                do_export_flickr.Sensitive = false;
                var md =
                    new HigMessageDialog(Dialog,
                                         Gtk.DialogFlags.Modal |
                                         Gtk.DialogFlags.DestroyWithParent,
                                         Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
                                         Catalog.GetString("Unable to log on."),
                                         string.Format(Catalog.GetString("F-Spot was unable to log on to {0}.  Make sure you have given the authentication using {0} web browser interface."),
                                                       current_service.Name));
                md.Run();
                md.Destroy();
                return;
            }

            fr.ExportTags           = tag_check.Active;
            fr.ExportTagHierarchy   = hierarchy_check.Active;
            fr.ExportIgnoreTopLevel = ignore_top_level_check.Active;
            open      = open_check.Active;
            scale     = scale_check.Active;
            is_public = public_radio.Active;
            is_family = family_check.Active;
            is_friend = friend_check.Active;
            if (scale)
            {
                size = size_spin.ValueAsInt;
            }

            command_thread      = new Thread(new ThreadStart(Upload));
            command_thread.Name = Catalog.GetString("Uploading Pictures");

            Dialog.Destroy();
            progress_dialog = new ThreadProgressDialog(command_thread, selection.Count);
            progress_dialog.Start();

            // Save these settings for next time
            Preferences.Set(SCALE_KEY, scale);
            Preferences.Set(SIZE_KEY, size);
            Preferences.Set(BROWSER_KEY, open);
            Preferences.Set(TAGS_KEY, tag_check.Active);
            Preferences.Set(PUBLIC_KEY, public_radio.Active);
            Preferences.Set(FAMILY_KEY, family_check.Active);
            Preferences.Set(FRIENDS_KEY, friend_check.Active);
            Preferences.Set(TAG_HIERARCHY_KEY, hierarchy_check.Active);
            Preferences.Set(IGNORE_TOP_LEVEL_KEY, ignore_top_level_check.Active);
            Preferences.Set(current_service.PreferencePath, fr.Token.Token);
            Preferences.Set(current_service.PreferencePath + "secret", fr.Token.TokenSecret);
            Preferences.Set(current_service.PreferencePath + "userId", fr.Token.UserId);
            Preferences.Set(current_service.PreferencePath + "userName", fr.Token.Username);
        }
コード例 #29
0
 private void OnUserSelectorResponse(object o, ResponseArgs args)
 {
     if(UserSelector != null)
        {
     switch(args.ResponseId)
     {
      case Gtk.ResponseType.Ok:
      {
       foreach(MemberInfo member in UserSelector.SelectedUsers)
       {
        if(!curUsers.ContainsKey(member.UserID))
        {
     try
     {
     iFolderUser newUser =
      ifws.AddAndInviteUser(
       ifolder.ID,
       member.Name,
       member.GivenName,
       member.FamilyName,
       member.UserID,
       null,
       "ReadWrite" );
      TreeIter iter =
       UserTreeStore.AppendValues(newUser);
      if (memberFullNames.Contains(newUser.FN))
      {
       duplicateMembers[newUser.FN] = 0;
      }
      else
       memberFullNames[newUser.FN] = 0;
      curUsers.Add(newUser.UserID, iter);
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied =
        new iFolderExceptionDialog(
      topLevelWindow, e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      ied = null;
      break;
     }
        }
       }
       UserSelector.Hide();
       UserSelector.Destroy();
       UserSelector = null;
       break;
      }
      case Gtk.ResponseType.Help:
      {
       Util.ShowHelp("sharewith.html#bq6lwm0", topLevelWindow);
       break;
      }
      case Gtk.ResponseType.Cancel:
      {
       UserSelector.Hide();
       UserSelector.Destroy();
       UserSelector = null;
       break;
      }
     }
        }
 }
コード例 #30
0
		void HandleResponse (object obj, ResponseArgs args) {
			if (args.ResponseId == ResponseType.Accept) {
				PhotoQuery query = new PhotoQuery (from_db.Photos);
				query.RollSet = mdd.ActiveRolls == null ? null : new RollSet (mdd.ActiveRolls);
				DoMerge (query, mdd.ActiveRolls, mdd.Copy);
			}
			mdd.Dialog.Destroy ();
		}
コード例 #31
0
 private void OnConflictDialogResponse(object o, ResponseArgs args)
 {
     if(ConflictDialog != null)
        {
     if (args.ResponseId == ResponseType.Help)
      Util.ShowHelp("conflicts.html", this);
     else
     {
      ConflictDialog.Hide();
      ConflictDialog.Destroy();
      ConflictDialog = null;
     }
        }
 }
コード例 #32
0
 private void OnLoginDialogResponse(object o, ResponseArgs args)
 {
     switch (args.ResponseId)
        {
     case Gtk.ResponseType.Ok:
      DomainInformation dom = domainController.GetDomain(LoginDialog.Domain);
      if (WaitDialog != null)
      {
       WaitDialog.Hide();
       WaitDialog.Destroy();
       WaitDialog = null;
      }
      VBox vbox = new VBox(false, 0);
      Image connectingImage = new Image(Util.ImagesPath("ifolder-add-account48.png"));
      vbox.PackStart(connectingImage, false, false, 0);
      WaitDialog =
       new iFolderWaitDialog(
        topLevelWindow,
        vbox,
        iFolderWaitDialog.ButtonSet.None,
        Util.GS("Connecting..."),
        Util.GS("Connecting..."),
        Util.GS("Please wait while your iFolder account is connecting."));
      if (!Util.RegisterModalWindow(WaitDialog))
      {
       try
       {
        Util.CurrentModalWindow.Present();
       }
       catch{}
       WaitDialog.Destroy();
       return;
      }
      WaitDialog.Show();
      DomainLoginThread domainLoginThread =
       new DomainLoginThread(domainController);
      domainLoginThread.Completed +=
       new DomainLoginCompletedHandler(OnDomainLoginCompleted);
      domainLoginThread.Login(dom.ID, LoginDialog.Password, LoginDialog.ShouldSavePassword);
      break;
     case Gtk.ResponseType.Cancel:
     case Gtk.ResponseType.DeleteEvent:
      LoginDialog.Hide();
      LoginDialog.Destroy();
      LoginDialog = null;
      break;
        }
 }
コード例 #33
0
 private void OnReLoginDialogResponse(object o, ResponseArgs args)
 {
     switch (args.ResponseId)
        {
     case Gtk.ResponseType.Ok:
      DomainInformation dom = domainController.GetDomain(LoginDialog.Domain);
      if (dom == null)
      {
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Account Error"),
        Util.GS("This account has been removed from your computer."),
        Util.GS("If you wish to connect to this account again, please add it in the Account Settings Dialog."));
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
       LoginDialog.Hide();
       LoginDialog.Destroy();
       LoginDialog = null;
       break;
      }
      try
      {
       string DomainID = LoginDialog.Domain;
       Status status =
        domainController.AuthenticateDomain(
     LoginDialog.Domain,
     LoginDialog.Password,
     LoginDialog.ShouldSavePassword);
       if (status != null)
       {
        switch(status.statusCode)
        {
     case StatusCodes.Success:
     case StatusCodes.SuccessInGrace:
      ifdata.Refresh();
      Debug.PrintLine("Login dialog response- success");
      LoginDialog.Hide();
      LoginDialog.Destroy();
      LoginDialog = null;
       ShowClientUpgradeMessageBox();
                                         int result;
       int policy = ifws.GetSecurityPolicy(DomainID);
       if( policy % 2 == 0)
        break;
                                         bool passphraseStatus = simws.IsPassPhraseSet(DomainID);
       if(passphraseStatus == true)
       {
        bool rememberOption = simws.GetRememberOption(DomainID);
        if( rememberOption == false)
        {
     ShowVerifyDialog( DomainID, simws);
        }
        else
        {
     Debug.PrintLine(" remember Option true. Checking for passphrase existence");
     string passphrasecheck;
     passphrasecheck= simws.GetPassPhrase(DomainID);
     if(passphrasecheck == null || passphrasecheck == "")
      ShowVerifyDialog( DomainID, simws);
        }
       }
       else
       {
        iFolderWindow.ShowEnterPassPhraseDialog(DomainID, simws);
       }
      break;
     case StatusCodes.InvalidCertificate:
      if( status.UserName != null)
      {
       dom.Host = status.UserName;
      }
      byte[] byteArray = simws.GetCertificate(dom.Host);
      System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(byteArray);
      iFolderMsgDialog dialog = new iFolderMsgDialog(
       null,
       iFolderMsgDialog.DialogType.Question,
       iFolderMsgDialog.ButtonSet.YesNo,
       "",
       Util.GS("Accept the certificate of this server?"),
       string.Format(Util.GS("iFolder is unable to verify \"{0}\" as a trusted server.  You should examine this server's identity certificate carefully."), dom.Host),
       cert.ToString(true));
      Gdk.Pixbuf certPixbuf = Util.LoadIcon("gnome-mime-application-x-x509-ca-cert", 48);
      if (certPixbuf != null && dialog.Image != null)
       dialog.Image.Pixbuf = certPixbuf;
      int rc = dialog.Run();
      dialog.Hide();
      dialog.Destroy();
      if(rc == -8)
      {
       simws.StoreCertificate(byteArray, dom.Host);
       OnReLoginDialogResponse(o, args);
      }
      else
      {
       domainController.DisableDomainAutoLogin(LoginDialog.Domain);
       LoginDialog.Hide();
       LoginDialog.Destroy();
       LoginDialog = null;
      }
      break;
     case StatusCodes.UserAlreadyMoved:
      OnReLoginDialogResponse(o, args);
      break;
     default:
      Util.ShowLoginError(LoginDialog, status.statusCode);
      break;
        }
       }
      }
      catch(Exception e)
      {
       iFolderMsgDialog dialog = new iFolderMsgDialog(
        null,
        iFolderMsgDialog.DialogType.Error,
        iFolderMsgDialog.ButtonSet.None,
        Util.GS("Account Error"),
        Util.GS("Unable to connect to the iFolder Server"),
        Util.GS("An error was encountered while connecting to the iFolder server.  Please verify the information entered and try again.  If the problem persists, please contact your network administrator."),
        e.Message);
       dialog.Run();
       dialog.Hide();
       dialog.Destroy();
       dialog = null;
      }
      break;
     case Gtk.ResponseType.Cancel:
     case Gtk.ResponseType.DeleteEvent:
      domainController.DisableDomainAutoLogin(LoginDialog.Domain);
      LoginDialog.Hide();
      LoginDialog.Destroy();
      LoginDialog = null;
      break;
        }
 }
コード例 #34
0
ファイル: BaseDialog.cs プロジェクト: gclark916/banshee
        private void OnResponse (object o, ResponseArgs args)
        {
            ResponseType response = args.ResponseId;

            if (response == ResponseType.Apply) {
                Queue ();
                return;
            }

            if (response == ResponseType.Ok) {
                Play ();
            }

            Destroy ();
        }
コード例 #35
0
ファイル: TreeViewDemo.cs プロジェクト: numerodix/nametrans
 private static void ResponseCB(object obj, ResponseArgs args)
 {
     Application.Quit ();
     System.Environment.Exit (0);
 }
コード例 #36
0
ファイル: PictureTile.cs プロジェクト: Yetangitu/f-spot
 void OnDialogReponse(object obj, ResponseArgs args)
 {
     if (args.ResponseId == ResponseType.Ok) {
         CreatePhotoWall ();
     }
     picturetile_dialog.Destroy ();
 }
コード例 #37
0
        void _OnUserResponse( object sender, ResponseArgs args )
        {
            _Trace( "[_OnUserResponse]" );

             switch (args.ResponseId)
             {
             case ResponseType.Ok:
            try
            {
               _database = _databaseEntry.Text;
               _mp3RootDir = _mp3RootDirEntry.Text;

               // Complain if the mp3 root dir doesn't exist.
               DirectoryInfo mp3DirInfo = new DirectoryInfo( _mp3RootDir );
               if (!mp3DirInfo.Exists)
               {
                  MessageDialog md =
                     new MessageDialog( _localConfigDialog,
                                        DialogFlags.Modal,
                                        MessageType.Error,
                                        ButtonsType.Ok,
                                        ("Directory '" + _mp3RootDir
                                         + "' does not exist") );
                  md.Run();
                  md.Destroy();
                  return;
               }

               // If the db file does not exist, create it. If necessary.
               FileInfo dbInfo = new FileInfo( _database );
               if (!dbInfo.Exists)
               {
                  // If we don't reate the file, quick exit here (keep
                  // the dialog going)
                  if (!_CreateDatabasePrompt( _database ))
                     return;
               }

               // If we got here, the controls validated
               _localConfigDialog.Destroy();
               _isOk = true;
            }
            catch (Exception exception)
            {
               _Trace( exception.ToString() );
            }
            break;

             case ResponseType.Cancel:
             default:
            _localConfigDialog.Destroy();
            break;              // er
             }
        }
コード例 #38
0
        private void OnStationEditorResponse (object o, ResponseArgs args)
        {
            StationEditor editor = (StationEditor)o;
            bool destroy = true;

            try {
                if (args.ResponseId == ResponseType.Ok) {
                    DatabaseTrackInfo track = editor.Track ?? new DatabaseTrackInfo ();
                    track.PrimarySource = this;
                    track.IsLive = true;

                    try {
                        track.Uri = new SafeUri (editor.StreamUri);
                    } catch {
                        destroy = false;
                        editor.ErrorMessage = Catalog.GetString ("Please provide a valid station URI");
                    }

                    if (!String.IsNullOrEmpty (editor.StationCreator)) {
                        track.ArtistName = editor.StationCreator;
                    }

                    track.Comment = editor.Description;

                    if (!String.IsNullOrEmpty (editor.Genre)) {
                        track.Genre = editor.Genre;
                    } else {
                        destroy = false;
                        editor.ErrorMessage = Catalog.GetString ("Please provide a station genre");
                    }

                    if (!String.IsNullOrEmpty (editor.StationTitle)) {
                        track.TrackTitle = editor.StationTitle;
                        track.AlbumTitle = editor.StationTitle;
                    } else {
                        destroy = false;
                        editor.ErrorMessage = Catalog.GetString ("Please provide a station title");
                    }

                    track.Rating = editor.Rating;

                    if (destroy) {
                        track.Save ();
                    }
                }
            } finally {
                if (destroy) {
                    editor.Response -= OnStationEditorResponse;
                    editor.Destroy ();
                }
            }
        }
コード例 #39
0
ファイル: Main.cs プロジェクト: BackupTheBerlios/nyfolder-svn
 // ============================================
 // PRIVATE (Methods) Event Handlers
 // ============================================
 private void OnLoginResponse(object sender, ResponseArgs args)
 {
     if (args.ResponseId == ResponseType.Ok) {
         DoLogin((GUI.Dialogs.Login) sender);
         if (myInfo != null) RunMainWindow();
     } else {
         Gtk.Application.Quit();
     }
 }
コード例 #40
0
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            int  size          = 0;
            bool UserCancelled = false;
            bool rotate        = true;

            // Lets remove the mail "create mail" dialog
            Dialog.Destroy();

            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                return;
            }
            ProgressDialog progress_dialog = null;

            progress_dialog = new ProgressDialog(Catalog.GetString("Preparing email"),
                                                 ProgressDialog.CancelButtonType.Stop,
                                                 selection.Count,
                                                 parent_window);

            size = GetScaleSize();             // Which size should we scale to. 0 --> Original

            // evaluate mailto command and define attachment args for cli
            System.Text.StringBuilder attach_arg = new System.Text.StringBuilder();
            switch (Preferences.Get <string> (Preferences.GNOME_MAILTO_COMMAND))
            {
            case "thunderbird %s":
            case "mozilla-thunderbird %s":
            case "seamonkey -mail -compose %s":
            case "icedove %s":
                attach_arg.Append(",");
                break;

            case "kmail %s":
                attach_arg.Append(" --attach ");
                break;

            default:                      //evolution falls into default, since it supports mailto uri correctly
                attach_arg.Append("&attach=");
                break;
            }

            rotate = rotate_check.Active;              // Should we automatically rotate original photos.
            Preferences.Set(Preferences.EXPORT_EMAIL_ROTATE, rotate);

            // Initiate storage for temporary files to be deleted later
            tmp_paths = new System.Collections.ArrayList();

            // Create a tmp directory.
            tmp_mail_dir = System.IO.Path.GetTempFileName();                    // Create a tmp file
            System.IO.File.Delete(tmp_mail_dir);                                // Delete above tmp file
            System.IO.Directory.CreateDirectory(tmp_mail_dir);                  // Create a directory with above tmp name

            System.Text.StringBuilder mail_attach = new System.Text.StringBuilder();

            FilterSet filters = new FilterSet();

            if (size != 0)
            {
                filters.Add(new ResizeFilter((uint)size));
            }
            else if (rotate)
            {
                filters.Add(new OrientationFilter());
            }
            filters.Add(new UniqueNameFilter(tmp_mail_dir));


            for (int i = 0; i < selection.Count; i++)
            {
                Photo photo = selection [i] as Photo;
                if ((photo != null) && (!UserCancelled))
                {
                    if (progress_dialog != null)
                    {
                        UserCancelled = progress_dialog.Update(String.Format
                                                                   (Catalog.GetString("Exporting picture \"{0}\""), photo.Name));
                    }

                    if (UserCancelled)
                    {
                        break;
                    }

                    try {
                        // Prepare a tmp_mail file name
                        FilterRequest request = new FilterRequest(photo.DefaultVersionUri);

                        filters.Convert(request);
                        request.Preserve(request.Current);

                        mail_attach.Append(attach_arg.ToString() + request.Current.ToString());

                        // Mark the path for deletion
                        tmp_paths.Add(request.Current.LocalPath);
                    } catch (Exception e) {
                        Console.WriteLine("Error preparing {0}: {1}", selection[photo_index].Name, e.Message);
                        HigMessageDialog md = new HigMessageDialog(parent_window,
                                                                   DialogFlags.DestroyWithParent,
                                                                   MessageType.Error,
                                                                   ButtonsType.Close,
                                                                   Catalog.GetString("Error processing image"),
                                                                   String.Format(Catalog.GetString("An error occured while processing \"{0}\": {1}"), selection[photo_index].Name, e.Message));
                        md.Run();
                        md.Destroy();
                        UserCancelled = true;
                    }
                }
            }             // foreach

            if (progress_dialog != null)
            {
                progress_dialog.Destroy();                  // No need to keep this window
            }
            if (UserCancelled)
            {
                DeleteTempFile();
            }
            else
            {
                // Send the mail :)
                string mail_subject = Catalog.GetString("my photos");
                switch (Preferences.Get <string> (Preferences.GNOME_MAILTO_COMMAND))
                {
                // openSuSE
                case "thunderbird %s":
                    System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                    break;

                case "icedove %s":
                    System.Diagnostics.Process.Start("icedove", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                    break;

                case "mozilla-thunderbird %s":
                    System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                    break;

                case "seamonkey -mail -compose %s":
                    System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                    break;

                case "kmail %s":
                    System.Diagnostics.Process.Start("kmail", "  --composer --subject \"" + mail_subject + "\"" + mail_attach);
                    break;

                default:
                    GnomeUtil.UrlShow("mailto:?subject=" + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach);
                    break;
                }

                // Check if we have any temporary files to be deleted
                if (tmp_paths.Count > 0)
                {
                    // Fetch timeout value from preferences. In seconds. Needs to be multiplied with 1000 to get msec
                    uint delete_timeout;
                    delete_timeout = (uint)(Preferences.Get <int> (Preferences.EXPORT_EMAIL_DELETE_TIMEOUT_SEC));
                    delete_timeout = delete_timeout * 1000;                     // to get milliseconds.

                    // Start a timer and when it occurs, delete the temp files.
                    GLib.Timeout.Add(delete_timeout, new GLib.TimeoutHandler(DeleteTempFile));
                }
            }
        }
コード例 #41
0
	private void HandleDialogResponse (object obj, ResponseArgs args)
	{
		if (args.ResponseId != ResponseType.Ok) {
			this.Cancel ();
			this.Dialog.Destroy ();
			return;
		}
	}
コード例 #42
0
ファイル: Main.cs プロジェクト: BackupTheBerlios/monopod-svn
    private void OnAboutResponse(object o, ResponseArgs args)
    {
        AboutDialog dialog = (AboutDialog) o;

        dialog.Destroy ();
    }
コード例 #43
0
ファイル: SendEmail.cs プロジェクト: ermshiperete/f-spot
        private void HandleResponse(object sender, Gtk.ResponseArgs args)
        {
            int  size          = 0;
            bool UserCancelled = false;

            // Lets remove the mail "create mail" dialog
            Destroy();

            if (args.ResponseId != Gtk.ResponseType.Ok)
            {
                return;
            }
            ProgressDialog progress_dialog = null;

            progress_dialog = new ProgressDialog(Catalog.GetString("Preparing email"),
                                                 ProgressDialog.CancelButtonType.Stop,
                                                 selection.Count,
                                                 parent_window);

            size = GetScaleSize();             // Which size should we scale to. 0 --> Original

            // evaluate mailto command and define attachment args for cli
            System.Text.StringBuilder attach_arg = new System.Text.StringBuilder();
            switch (Preferences.Get <string> (Preferences.GNOME_MAILTO_COMMAND))
            {
            case "thunderbird %s":
            case "mozilla-thunderbird %s":
            case "seamonkey -mail -compose %s":
            case "icedove %s":
                attach_arg.Append(",");
                break;

            case "kmail %s":
                attach_arg.Append(" --attach ");
                break;

            default:            //evolution falls into default, since it supports mailto uri correctly
                attach_arg.Append("&attach=");
                break;
            }

            // Create a tmp directory.
            tmp_mail_dir = System.IO.Path.GetTempFileName();                    // Create a tmp file
            System.IO.File.Delete(tmp_mail_dir);                                // Delete above tmp file
            System.IO.Directory.CreateDirectory(tmp_mail_dir);                  // Create a directory with above tmp name

            System.Text.StringBuilder mail_attach = new System.Text.StringBuilder();

            FilterSet filters = new FilterSet();

            if (size != 0)
            {
                filters.Add(new ResizeFilter((uint)size));
            }
            filters.Add(new UniqueNameFilter(new SafeUri(tmp_mail_dir)));


            for (int i = 0; i < selection.Count; i++)
            {
                var photo = selection [i];
                if ((photo != null) && (!UserCancelled))
                {
                    if (progress_dialog != null)
                    {
                        UserCancelled = progress_dialog.Update(String.Format
                                                                   (Catalog.GetString("Exporting picture \"{0}\""), photo.Name));
                    }

                    if (UserCancelled)
                    {
                        break;
                    }

                    try {
                        // Prepare a tmp_mail file name
                        FilterRequest request = new FilterRequest(photo.DefaultVersion.Uri);

                        filters.Convert(request);
                        request.Preserve(request.Current);

                        mail_attach.Append(((i == 0 && attach_arg.ToString() == ",") ? "" : attach_arg.ToString()) + request.Current.ToString());
                    } catch (Exception e) {
                        Hyena.Log.ErrorFormat("Error preparing {0}: {1}", selection[i].Name, e.Message);
                        HigMessageDialog md = new HigMessageDialog(parent_window,
                                                                   DialogFlags.DestroyWithParent,
                                                                   MessageType.Error,
                                                                   ButtonsType.Close,
                                                                   Catalog.GetString("Error processing image"),
                                                                   String.Format(Catalog.GetString("An error occurred while processing \"{0}\": {1}"), selection[i].Name, e.Message));
                        md.Run();
                        md.Destroy();
                        UserCancelled = true;
                    }
                }
            }             // foreach

            if (progress_dialog != null)
            {
                progress_dialog.Destroy();                  // No need to keep this window
            }
            if (UserCancelled)
            {
                return;
            }

            // Send the mail :)
            string mail_subject = Catalog.GetString("My Photos");

            switch (Preferences.Get <string> (Preferences.GNOME_MAILTO_COMMAND))
            {
            // openSuSE
            case "thunderbird %s":
                System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                break;

            case "icedove %s":
                System.Diagnostics.Process.Start("icedove", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                break;

            case "mozilla-thunderbird %s":
                System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                break;

            case "seamonkey -mail -compose %s":
                System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\"");
                break;

            case "kmail %s":
                System.Diagnostics.Process.Start("kmail", "  --composer --subject \"" + mail_subject + "\"" + mail_attach);
                break;

            case "evolution %s":             //evo doesn't urldecode the subject
                GtkBeans.Global.ShowUri(Screen, "mailto:?subject=" + mail_subject + mail_attach);
                break;

            default:
                GtkBeans.Global.ShowUri(Screen, "mailto:?subject=" + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach);
                break;
            }
        }
コード例 #44
0
 private void OnAccountDialogResponse(object o, ResponseArgs args)
 {
     this.Hide();
        this.Destroy();
 }
コード例 #45
0
        protected void _OnUserResponse( object sender, ResponseArgs args )
        {
            _Trace( "[_OnUserResponse]" );

             // Well, there's only just the Close button...
             _miscSettingsDialog.Destroy();
        }
コード例 #46
0
ファイル: LiveWebGallery.cs プロジェクト: Yetangitu/f-spot
 void HandleResponse(object obj, ResponseArgs args)
 {
     dialog.Destroy ();
 }
コード例 #47
0
ファイル: MetaPixel.cs プロジェクト: Yetangitu/f-spot
 void on_dialog_response(object obj, ResponseArgs args)
 {
     if (args.ResponseId == ResponseType.Ok) {
         create_mosaics ();
     }
     metapixel_dialog.Destroy ();
 }
コード例 #48
0
 private void OnPropertiesDialogResponse(object o, ResponseArgs args)
 {
     iFolderPropertiesDialog propsDialog = (iFolderPropertiesDialog) o;
        switch(args.ResponseId)
        {
     case Gtk.ResponseType.Help:
      if (propsDialog != null)
      {
       if (propsDialog.CurrentPage == 0)
       {
        Util.ShowHelp("propifolders.html", this);
       }
       else if (propsDialog.CurrentPage == 1)
       {
        Util.ShowHelp("sharewith.html", this);
       }
       else
       {
        Util.ShowHelp("front.html", this);
       }
      }
      break;
     default:
     {
      if(propsDialog != null)
      {
       propsDialog.Hide();
       propsDialog.Destroy();
       if (PropDialogs.ContainsKey(propsDialog.iFolder.ID))
        PropDialogs.Remove(propsDialog.iFolder.ID);
       propsDialog = null;
      }
      break;
     }
        }
 }
コード例 #49
0
        void OnDialogResponse(object o, Gtk.ResponseArgs args)
        {
            lock (LockObj) {
                if (args.ResponseId == ResponseType.Ok && dataBook != null && dataBook.NPages > 0)
                {
                    DataView dv = ((DataViewDisplay)dataBook.CurrentPageWidget).View;

                    IExportBuilder builder = null;
                    TreeIter       iter;
                    ExportAsCombo.GetActiveIter(out iter);
                    ExportPlugin plugin = (ExportPlugin)ExportAsCombo.Model.GetValue(iter, 1);


                    Util.Range range;

                    try {
                        range = GetCurrentRange(dv);
                    }
                    catch (FormatException ex) {
                        ErrorAlert ea = new ErrorAlert(Catalog.GetString("Error in custom range"), ex.Message, mainWindow);
                        ea.Run();
                        ea.Destroy();
                        return;
                    }

                    Util.Range bufferRange;
                    if (dv.Buffer.Size == 0)
                    {
                        bufferRange = new Util.Range();
                    }
                    else
                    {
                        bufferRange = new Util.Range(0, dv.Buffer.Size - 1);
                    }

                    if (!bufferRange.Contains(range.Start) || !bufferRange.Contains(range.End))
                    {
                        ErrorAlert ea = new ErrorAlert(Catalog.GetString("Error in range"), Catalog.GetString("Range is out of file's limits"), mainWindow);
                        ea.Run();
                        ea.Destroy();
                        return;
                    }

                    Stream stream = null;
                    try {
                        stream  = new FileStream(ExportFileEntry.Text, FileMode.Create, FileAccess.Write);
                        builder = plugin.CreateBuilder(stream);

                        InterpretedPatternExporter exporter = new InterpretedPatternExporter(builder);
                        exporter.Pattern = ExportPatternComboEntry.Entry.Text;

                        cancelClicked = false;
                        BeginExport(exporter, dv.Buffer, range.Start, range.End);
                    }
                    catch (Exception ex) {
                        if (stream != null)
                        {
                            stream.Close();
                        }

                        ErrorAlert ea = new ErrorAlert(Catalog.GetString("Error saving to file"), ex.Message, mainWindow);
                        ea.Run();
                        ea.Destroy();
                        return;
                    }
                }
                else if (args.ResponseId == ResponseType.Close)
                {
                    this.Hide();
                }
            }
        }
コード例 #50
0
 private void OnResponse(object obj, ResponseArgs args)
 {
     Destroy ();
 }
コード例 #51
0
 void HandleResponse(object obj, Gtk.ResponseArgs args)
 {
     Destroy();
 }