Exemple #1
0
        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
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        /*
         * 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 { }
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        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
            }
        }
Exemple #8
0
 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
 }