本文整理汇总了C#中Photo.DeleteVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Photo.DeleteVersion方法的具体用法?C# Photo.DeleteVersion怎么用?C# Photo.DeleteVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo.DeleteVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
{
// FIXME HIG-ify.
Dialog dialog = new Dialog ();
dialog.BorderWidth = 6;
dialog.TransientFor = parent_window;
dialog.HasSeparator = false;
dialog.Title = Catalog.GetString ("Really Delete?");
dialog.AddButton (Catalog.GetString ("Cancel"), (int) ResponseType.Cancel);
dialog.AddButton (Catalog.GetString ("Delete"), (int) ResponseType.Ok);
dialog.DefaultResponse = ResponseType.Ok;
string version_name = photo.GetVersion (photo.DefaultVersionId).Name;
Label label = new Label (String.Format (Catalog.GetString ("Really delete version \"{0}\"?"), version_name));
label.Show ();
dialog.VBox.PackStart (label, false, true, 6);;
if (dialog.Run () == (int) ResponseType.Ok) {
try {
photo.DeleteVersion (photo.DefaultVersionId);
store.Commit (photo);
} catch (Exception e) {
Log.DebugException (e);
string msg = Catalog.GetString ("Could not delete a version");
string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to delete version \"{1}\""),
e.Message, photo.Name);
HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent,
Gtk.MessageType.Error, ButtonsType.Ok,
msg,
desc);
md.Run ();
md.Destroy ();
dialog.Destroy (); // Delete confirmation window.
return false;
}
dialog.Destroy ();
return true;
}
dialog.Destroy ();
return false;
}
示例2: Execute
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
{
string ok_caption = Catalog.GetString ("De_tach");
string msg = String.Format (Catalog.GetString ("Really detach version \"{0}\" from \"{1}\"?"), photo.DefaultVersion.Name, photo.Name.Replace("_", "__"));
string desc = Catalog.GetString ("This makes the version appear as a separate photo in the library. To undo, drag the new photo back to its parent.");
try {
if (ResponseType.Ok == HigMessageDialog.RunHigConfirmation(parent_window, DialogFlags.DestroyWithParent,
MessageType.Warning, msg, desc, ok_caption)) {
Photo new_photo = store.CreateFrom (photo, photo.RollId);
new_photo.CopyAttributesFrom (photo);
photo.DeleteVersion (photo.DefaultVersionId, false, true);
store.Commit (new Photo[] {new_photo, photo});
return true;
}
} catch (Exception e) {
HandleException ("Could not detach a version", e, parent_window);
}
return false;
}