예제 #1
0
        public bool Execute(RotateDirection direction, IPhoto[] items)
        {
            ProgressDialog progress_dialog = null;

            if (items.Length > 1)
            {
                progress_dialog = new ProgressDialog(Strings.RotatingPhotos, ProgressDialog.CancelButtonType.Stop, items.Length, parentWindow);
            }

            var  op             = new RotateMultiple(items, direction);
            int  readonly_count = 0;
            bool done           = false;
            int  index          = 0;

            while (!done)
            {
                if (progress_dialog != null && op.Index != -1 && index < items.Length)
                {
                    if (progress_dialog.Update(Strings.RotatingPhotoX(op.Items[op.Index].Name)))
                    {
                        break;
                    }
                }

                try {
                    done = !op.Step();
                } catch (RotateException re) {
                    if (!re.ReadOnly)
                    {
                        RunGenericError(re, re.Path, re.Message);
                    }
                    else
                    {
                        readonly_count++;
                    }
                } catch (GLib.GException) {
                    readonly_count++;
                } catch (DirectoryNotFoundException e) {
                    RunGenericError(e, op.Items[op.Index].DefaultVersion.Uri.LocalPath, Strings.DirectoryNotFound);
                } catch (FileNotFoundException e) {
                    RunGenericError(e, op.Items[op.Index].DefaultVersion.Uri.LocalPath, Strings.FileNotFound);
                } catch (Exception e) {
                    RunGenericError(e, op.Items[op.Index].DefaultVersion.Uri.LocalPath);
                }
                index++;
            }

            progress_dialog?.Destroy();

            if (readonly_count > 0)
            {
                RunReadonlyError(readonly_count);
            }

            return(true);
        }
예제 #2
0
	public bool Execute (RotateDirection direction, IPhoto [] items)
	{
		ProgressDialog progress_dialog = null;

		if (items.Length > 1)
			progress_dialog = new ProgressDialog (Catalog.GetString ("Rotating photos"),
							      ProgressDialog.CancelButtonType.Stop,
							      items.Length, parent_window);

	        RotateMultiple op = new RotateMultiple (items, direction);
		int readonly_count = 0;
		bool done = false;
		int index = 0;

		while (!done) {
			if (progress_dialog != null && op.Index != -1 && index < items.Length)
				if (progress_dialog.Update (String.Format (Catalog.GetString ("Rotating photo \"{0}\""), op.Items [op.Index].Name)))
					break;

			try {
				done = !op.Step ();
			} catch (RotateException re) {
				if (!re.ReadOnly)
					RunGenericError (re, re.Path, re.Message);
				else
					readonly_count++;
			} catch (GLib.GException) {
				readonly_count++;
			} catch (DirectoryNotFoundException e) {
				RunGenericError (e, op.Items [op.Index].DefaultVersion.Uri.LocalPath, Catalog.GetString ("Directory not found"));
			} catch (FileNotFoundException e) {
				RunGenericError (e, op.Items [op.Index].DefaultVersion.Uri.LocalPath, Catalog.GetString ("File not found"));
			} catch (Exception e) {
				RunGenericError (e, op.Items [op.Index].DefaultVersion.Uri.LocalPath);
			}
			index ++;
		}

		if (progress_dialog != null)
			progress_dialog.Destroy ();

		if (readonly_count > 0)
			RunReadonlyError (readonly_count);

		return true;
	}
	public bool Execute (RotateDirection direction, IBrowsableItem [] items)
	{
		ProgressDialog progress_dialog = null;
		
		if (items.Length > 1)
			progress_dialog = new ProgressDialog (Catalog.GetString ("Rotating photos"),
							      ProgressDialog.CancelButtonType.Stop,
							      items.Length, parent_window);
		
	        RotateMultiple op = new RotateMultiple (items, direction);
		int readonly_count = 0;
		bool done = false;
		int index = -1;

		while (!done) {
			if (progress_dialog != null && index != op.Index) 
				progress_dialog.Update (String.Format (Catalog.GetString ("Rotating photo \"{0}\""), op.Items [op.Index].Name));

			try {
				done = !op.Step ();
			} catch (RotateException re) {
				if (re.Message == "Unable to rotate photo type")
					RunTypeError (re);
				else
					readonly_count ++;
			} catch (Exception e) {
				RunGenericError (e, op.Items [op.Index].DefaultVersionUri.LocalPath);
			}
		}
		
		if (progress_dialog != null)
			progress_dialog.Destroy ();
		
		if (readonly_count > 0)
			RunReadonlyError (readonly_count);
		
		return true;
	}