Пример #1
0
        //context menu item clicked
        private async void RightClickMovieContextMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var    b    = (Button)rightClickMovieContextMenu.Tag;
            var    m    = (Movie.Data)b.Tag;
            string desc = "";

            switch (e.ClickedItem.Text)
            {
            case "Enable / Disable":
            {
                if (m.enabled)
                {
                    desc      = "Are you sure you want to DISABLE this movie!";
                    m.enabled = false;
                }
                else
                {
                    desc      = "Are you sure you want to ENABLE this movie!";
                    m.enabled = true;
                }
                if (MessageBox.Show(desc, m.Movie_Info.title, MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                {
                    var r = await API.Communication.Set.MovieStatus(m);

                    var x = await r.Content.ReadAsStringAsync();

                    if (x.Contains("disabled") || x.Contains("enabled"))
                    {
                        var a = await API.Communication.Get.RefreshData(GlobalVar.GlobalAuthUser);

                        //await SetMovieList();
                    }
                }
            }
            break;

            case "Edit":
            {
                Views.Edit edit = new Views.Edit(m, b);
                edit.Show();
            }
            break;

            case "View":
            {
                Views.ViewMovie view = new Views.ViewMovie(m.guid);
                view.Show();
            }
            break;
            }
        }
Пример #2
0
        private async void button_movie_Click(object sender, EventArgs e)
        {
            var item = (Button)sender;
            var m    = (Movie.Data)item.Tag;

            if (m == null)
            {
                MessageBox.Show("There seems to be no movie selected!");
            }
            else
            {
                Views.Edit ed = new Views.Edit(m, item);
                if (ed.ShowDialog() == DialogResult.OK)
                {
                    await SetMovieList();
                }
            }
        }