Esempio n. 1
0
        public static PlaylistVM CreatePlaylist(Window owner)
        {
            try
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(AppSettings.Culture);

                DialogText dlg = new DialogText();
                dlg.Init(Properties.Resources.Playlist_Name + " ", "");
                dlg.Owner = owner;
                bool?res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                {
                    if (string.IsNullOrEmpty(dlg.EnteredText))
                    {
                        Utils.ShowErrorMessage(Properties.Resources.Playlist_NameBlank);
                        return(null);
                    }

                    JMMServerBinary.Contract_Playlist pl = new JMMServerBinary.Contract_Playlist();
                    pl.DefaultPlayOrder = (int)PlaylistPlayOrder.Sequential;
                    pl.PlaylistItems    = "";
                    pl.PlaylistName     = dlg.EnteredText;
                    pl.PlayUnwatched    = 1;
                    pl.PlayWatched      = 0;
                    JMMServerBinary.Contract_Playlist_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SavePlaylist(pl);

                    if (!string.IsNullOrEmpty(resp.ErrorMessage))
                    {
                        Utils.ShowErrorMessage(resp.ErrorMessage);
                        return(null);
                    }

                    // refresh data
                    PlaylistHelperVM.Instance.RefreshData();

                    PlaylistVM plRet = new PlaylistVM(resp.Playlist);
                    return(plRet);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
                return(null);
            }
        }
Esempio n. 2
0
        public static PlaylistVM CreatePlaylist(Window owner)
        {
            try
            {
                DialogText dlg = new DialogText();
                dlg.Init("Enter playlist name: ", "");
                dlg.Owner = owner;
                bool?res = dlg.ShowDialog();
                if (res.HasValue && res.Value)
                {
                    if (string.IsNullOrEmpty(dlg.EnteredText))
                    {
                        Utils.ShowErrorMessage("Please enter a playlist name");
                        return(null);
                    }

                    JMMServerBinary.Contract_Playlist pl = new JMMServerBinary.Contract_Playlist();
                    pl.DefaultPlayOrder = (int)PlaylistPlayOrder.Sequential;
                    pl.PlaylistItems    = "";
                    pl.PlaylistName     = dlg.EnteredText;
                    pl.PlayUnwatched    = 1;
                    pl.PlayWatched      = 0;
                    JMMServerBinary.Contract_Playlist_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SavePlaylist(pl);

                    if (!string.IsNullOrEmpty(resp.ErrorMessage))
                    {
                        Utils.ShowErrorMessage(resp.ErrorMessage);
                        return(null);
                    }

                    // refresh data
                    PlaylistHelperVM.Instance.RefreshData();

                    PlaylistVM plRet = new PlaylistVM(resp.Playlist);
                    return(plRet);
                }

                return(null);
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
                return(null);
            }
        }
Esempio n. 3
0
        public void Save()
        {
            JMMServerBinary.Contract_Playlist pl = new JMMServerBinary.Contract_Playlist();
            pl.PlaylistID       = this.PlaylistID;
            pl.DefaultPlayOrder = this.DefaultPlayOrder;
            pl.PlaylistItems    = this.PlaylistItems;
            pl.PlaylistName     = this.PlaylistName;
            pl.PlayUnwatched    = this.PlayUnwatched;
            pl.PlayWatched      = this.PlayWatched;
            JMMServerBinary.Contract_Playlist_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SavePlaylist(pl);

            if (!string.IsNullOrEmpty(resp.ErrorMessage))
            {
                Utils.ShowErrorMessage(resp.ErrorMessage);
                return;
            }

            this.PlayWatchedBool   = PlayWatched == 1;
            this.PlayUnwatchedBool = PlayUnwatched == 1;
        }