public override void Execute(object parameter) { //TODO: toggle visibility of Details pane (may need to pass pivot viewer itself at constructor or a reference to the details pane) PivotViewerItem item = (PivotViewerItem)parameter; Clipboard.SetText((string)item["Href"][0]); //Copy raw URL to Clipboard }
public OpenCommand(PivotViewerItem item) : base() { DisplayName = ""; Icon = new System.Uri("/ClipFlair.Windows.Gallery;component/Images/Open.png", UriKind.Relative); //must specify that this is a relative Uri string url = (string)item["Href"][0]; ToolTip = "Open " + url; IsExecutable = !string.IsNullOrWhiteSpace(url); }
/* * public override void ShowOptions() //workarround: Can't turn over Pivot viewer when using 3D-style rotation, thowing transformation class cast errors (the IsAnimated=false isn't enough, need this too, else at resize etc. when flipped will throw exceptions) * { * if (!Flipped) * pivot.Visibility = Visibility.Collapsed; * * base.ShowOptions(); * * if (!Flipped) * pivot.Visibility = Visibility.Visible; * } */ #endregion #region Events private void GalleryItemAdorner_CommandsRequested(object sender, PivotViewerCommandsRequestedEventArgs e) { //if (e.IsItemSelected) { PivotViewerItem item = (PivotViewerItem)e.Item; try { e.Commands.Add(new InfoCommand(item)); } catch { } try { e.Commands.Add(new ShareCommand(item)); } catch { } try { e.Commands.Add(new DownloadCommand(item)); } catch { } try { e.Commands.Add(new OpenCommand(item)); } catch { } } }
public override void Execute(object parameter) { PivotViewerItem item = (PivotViewerItem)parameter; string filename = (string)item["Filename"][0]; string href = (string)item["Href"][0]; bool isVideo = href.Contains("?video="); bool isImage = href.Contains("?image="); Uri uri = new Uri("http://gallery.clipflair.net/" + ((isImage)? "image" : "activity") + "/" + filename); BrowserDialog.Show(uri); }
public override void Execute(object parameter) { PivotViewerItem item = (PivotViewerItem)parameter; IList nameData = item["Name"]; string name = (nameData != null && nameData.Count > 0)? (string)nameData[0] : ""; if (name == null) { name = ""; //just to be safe } Uri uri = new Uri("http://api.addthis.com/oexchange/0.8/offer?url=" + (string)item["Href"][0] + "&title=" + name ); BrowserDialog.Show(uri); }
protected string makeTooltip(PivotViewerItem item) { IList nameData = item["Name"]; string name = (nameData != null && nameData.Count > 0)? (string)nameData[0] : ""; if (name == null) { name = ""; //just to be safe } IList descriptionData = item["Description"]; string description = (descriptionData != null && descriptionData.Count > 0) ? (string)descriptionData[0] : ""; if (description == null) { description = ""; //just to be safe } return(name + ((name.IsEmpty() || description.IsEmpty())? "" : "\n\n") + description); }
public DownloadCommand(PivotViewerItem item) : base() { DisplayName = ""; Icon = new System.Uri("/ClipFlair.Windows.Gallery;component/Images/Download.png", UriKind.Relative); //must specify that this is a relative Uri string filename = (string)item["Filename"][0]; string href = (string)item["Href"][0]; bool isVideo = href.Contains("?video="); bool isImage = href.Contains("?image="); string url = "http://gallery.clipflair.net/" + ((isImage)? "image" : "activity") + "/" + filename; ToolTip = "Download " + url; IsExecutable = !string.IsNullOrWhiteSpace(url) && !isVideo; if (isVideo) { throw new NotImplementedException(); //TODO: need to add .mp4 files for each smooth stream } }
public InfoCommand(PivotViewerItem item) : base() { Icon = new System.Uri("/ClipFlair.Windows.Gallery;component/Images/Info.png", UriKind.Relative); //must specify that this is a relative Uri ToolTip = makeTooltip(item); IsExecutable = true; //needed to show the tooltip }