Exemple #1
0
        internal static async Task <bool> OpenFeedItem(FeedItem item, IDevRantClient api, Window owner)
        {
            if (item is ViewModels.Notification)
            {
                var notif = item.AsNotification();
                var raw   = await api.GetRant(notif.RantId);

                item = new ViewModels.Rant(raw);
            }
            else if (item is ViewModels.Comment)
            {
                var raw = await api.GetRant(item.AsComment().RantId);

                item = new ViewModels.Rant(raw);
            }


            if (item is ViewModels.Rant)
            {
                var rant = item.AsRant();

                if (rant.CanAnimate == Visibility.Visible) //TODO: should be bool
                {
                    string url = GetRantUrl(rant.RantId);
                    Process.Start(url);
                }
                else
                {
                    Window dlg;
                    dlg = new RantViewerWindow((ViewModels.Rant)item, api);

                    dlg.Owner = owner;
                    dlg.ShowDialog();
                }
            }
            else if (item is ViewModels.Collab)
            {
                string url = GetRantUrl(item.AsCollab().RantId);
                Process.Start(url);
            }
            else
            {
                return(false);
            }

            return(true);
        }