public void SelectedItemChangedprocessing() { try { mymessage = mymessages.GetTvMessageFilteredAtIndex(_focusedMessage); Log.Debug("_focusedMessage=" + _focusedMessage.ToString()); Log.Debug("mymessage.title="+mymessage.title); Log.Debug("mymessage.start=" + mymessage.start.ToString()); _dialogMenuItemList.Clear(); DialogHeader = PluginGuiLocalizeStrings.Get(3200); ListItem myitem1 = new ListItem(); myitem1.SetLabel("Name", PluginGuiLocalizeStrings.Get(3500)); //Goto TV (1) myitem1.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.GotoTv); }); _dialogMenuItemList.Add(myitem1); ListItem myitem2 = new ListItem(); myitem2.SetLabel("Name", PluginGuiLocalizeStrings.Get(1053)); //Create TvWish with Title in Email Mode myitem2.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.CreateTvWishEmail); }); _dialogMenuItemList.Add(myitem2); ListItem myitem3 = new ListItem(); myitem3.SetLabel("Name", PluginGuiLocalizeStrings.Get(1054)); //Create TvWish with Title in ViewOnly Mode myitem3.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.CreateTvWishViewOnly); }); _dialogMenuItemList.Add(myitem3); ListItem myitem4 = new ListItem(); myitem4.SetLabel("Name", PluginGuiLocalizeStrings.Get(1055)); //Create TvWish with All in Email Mode myitem4.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.CreateTvWishAllEmail); }); _dialogMenuItemList.Add(myitem4); ListItem myitem5 = new ListItem(); myitem5.SetLabel("Name", PluginGuiLocalizeStrings.Get(1056)); //Create TvWish with All in ViewOnly Mode myitem5.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.CreateTvWishAllViewOnly); }); _dialogMenuItemList.Add(myitem5); if ((mymessage.type == MessageType.Deleted.ToString()) || (mymessage.type == MessageType.Conflict.ToString())) { ListItem myitem6 = new ListItem(); myitem6.SetLabel("Name", PluginGuiLocalizeStrings.Get(3503)); //Delete message myitem6.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.DeleteMessage); }); _dialogMenuItemList.Add(myitem6); } else if ((mymessage.type == MessageType.Emailed.ToString()) || (mymessage.type == MessageType.Viewed.ToString()) || (mymessage.type == MessageType.Scheduled.ToString())) { ListItem myitem6 = new ListItem(); myitem6.SetLabel("Name", PluginGuiLocalizeStrings.Get(3503)); //Delete message myitem6.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.DeleteMessage); }); _dialogMenuItemList.Add(myitem6); bool scheduleExists = false; //check all schedules Log.Debug("check all schedules:"); foreach (Schedule myschedule in Schedule.ListAll()) { Log.Debug("mymessage.title=" + mymessage.title); Log.Debug("myschedule.ProgramName=" + myschedule.ProgramName); Log.Debug("mymessage.channel_id=" + mymessage.channel_id.ToString()); Log.Debug("myschedule.IdChannel=" + myschedule.IdChannel.ToString()); if ((mymessage.title == myschedule.ProgramName) && (mymessage.channel_id == myschedule.IdChannel) && (mymessage.start == myschedule.StartTime) && (mymessage.end == myschedule.EndTime)) { scheduleExists = true; Log.Debug("Schedule found"); break; } } Log.Debug("scheduleExists=" + scheduleExists.ToString()); if (scheduleExists) {//Delete Schedule ListItem myitem7 = new ListItem(); myitem7.SetLabel("Name", PluginGuiLocalizeStrings.Get(3501)); //Delete Schedule myitem7.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.DeleteSchedule); }); _dialogMenuItemList.Add(myitem7); } else {//Schedule // add prerecord, postrecord, keepuntil, priority, // change public void SelectedItemChanged(ListItem selectedListItem) in Common_Edit_AND_ConfigDefaults.cs //int index =Convert.ToInt32(mymessage.tvwishid); //Log.Debug("index=" + index.ToString()); TvWish mywish = myTvWishes.GetAtTvWishId(mymessage.tvwishid); Log.Debug(" mywish.searchfor=" + mywish.searchfor); Log.Debug(" mywish.tvwishid=" + mywish.tvwishid); myTvWishes.FocusedWishIndex = myTvWishes.GetIndex(mywish); Log.Debug("myTvWishes.FocusedWishIndex=" + myTvWishes.FocusedWishIndex.ToString()); ListItem myitem7 = new ListItem(); myitem7.SetLabel("Name", PluginGuiLocalizeStrings.Get(3502)); //Schedule myitem7.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.Schedule); }); _dialogMenuItemList.Add(myitem7); ListItem myitem8 = new ListItem(); //Prerecord string mystring = String.Format(PluginGuiLocalizeStrings.Get(2508), mywish.prerecord); Log.Debug("initial: mystring=" + mystring); myitem8.SetLabel("Name", mystring); //Prerecord myitem8.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); CaseSelection = (int)TvWishEntries.prerecord; EvaluateSelectedItem(mymessage, (int)MenuItems.Prerecord); }); _dialogMenuItemList.Add(myitem8); ListItem myitem9 = new ListItem(); //Postrecord mystring = String.Format(PluginGuiLocalizeStrings.Get(2509), mywish.postrecord); Log.Debug("initial: mystring=" + mystring); myitem9.SetLabel("Name", mystring); //Postrecord myitem9.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); CaseSelection = (int)TvWishEntries.postrecord; EvaluateSelectedItem(mymessage, (int)MenuItems.Postrecord); }); _dialogMenuItemList.Add(myitem9); ListItem myitem10 = new ListItem(); //Keepuntil mystring = String.Format(PluginGuiLocalizeStrings.Get(2515), mywish.keepuntil); Log.Debug("initial: mystring=" + mystring); myitem10.SetLabel("Name", mystring); //Keepuntil myitem10.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); CaseSelection = (int)TvWishEntries.keepuntil; EvaluateSelectedItem(mymessage, (int)MenuItems.Keepuntil); }); _dialogMenuItemList.Add(myitem10); } } else if (mymessage.type == MessageType.Recorded.ToString()) { ListItem myitem6 = new ListItem(); myitem6.SetLabel("Name", PluginGuiLocalizeStrings.Get(3504)); //Delete recording myitem6.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.DeleteRecording); }); _dialogMenuItemList.Add(myitem6); ListItem myitem7 = new ListItem(); myitem7.SetLabel("Name", PluginGuiLocalizeStrings.Get(3505)); //Goto recordings myitem7.Command = new MethodDelegateCommand(() => { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); EvaluateSelectedItem(mymessage, (int)MenuItems.GotoVideo); }); _dialogMenuItemList.Add(myitem7); } //update for dialog skin DialogMenuItemList.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN); } catch (Exception exc) { Log.Error("[TVWishListMP2 GUI_List]:SelectedItemChanged failed exception: " + exc.Message); } }
public void EvaluateSelectedItem(xmlmessage mymessage,int casenumber) { //button lock if (myTvWishes.ButtonActive) { myTvWishes.StatusLabel(PluginGuiLocalizeStrings.Get(1200)); //Waiting for old process to finish "Previous Operation Is Still Running" return; } myTvWishes.ButtonActive = true; //lock buttons try { int tvMessageindex = mymessage.unfiltered_index; Log.Debug("tvMessageindex filtered=" + _focusedMessage.ToString()); Log.Debug("tvMessageindex unfiltered=" + tvMessageindex.ToString()); //possible bug can cause exception!!!!!!!!!!!!!!!! TvWish mywish = myTvWishes.RetrieveById(mymessage.tvwishid); //TvWish mywish = myTvWishes.GetAtTvWishId(myTvWishes.FocusedWishIndex); // find out if schedule exists for selected item Schedule foundSchedule = null; foreach (Schedule myschedule in Schedule.ListAll()) { if ((mymessage.title == myschedule.ProgramName) && (mymessage.channel_id == myschedule.IdChannel) && (mymessage.start == myschedule.StartTime) && (mymessage.end == myschedule.EndTime)) { foundSchedule = myschedule; Log.Debug("Schedule found title=" + foundSchedule.ProgramName); break; } } Recording foundRecording = null; foreach (Recording myrecording in Recording.ListAll()) { //if ((mymessages.GetTvMessageFilteredAtIndex(myfacade.SelectedListItemIndex).title == myrecording.Title) && (mymessages.GetTvMessageFilteredAtIndex(myfacade.SelectedListItemIndex).channel_id == myrecording.IdChannel) && (mymessages.GetTvMessageFilteredAtIndex(myfacade.SelectedListItemIndex).start == myrecording.StartTime) && (mymessages.GetTvMessageFilteredAtIndex(myfacade.SelectedListItemIndex).end == myrecording.EndTime)) if (mymessage.recordingid == myrecording.IdRecording.ToString()) { foundRecording = myrecording; break; } } if (foundRecording != null) Log.Debug("found Recording ID=" + mymessage.recordingid.ToString() + " title=" + foundRecording.Title + " at " + foundRecording.StartTime.ToString()); IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>(); switch (casenumber) { case (int)MenuItems.GotoTv: //Goto Tv main screen try { if (workflowManager.NavigatePopModel(TV_GUI_MODEL_ID)) {// do nothing } else { workflowManager.NavigatePopToState(HOME_GUI_STATE_ID, true); workflowManager.NavigatePush(TV_GUI_STATE_ID); } } catch { Log.Error("Workflow navigation to TV failed"); } break; case (int)MenuItems.CreateTvWishEmail://Create TvWish with Title in Email Mode try { string parameter = Main_GUI.SkinCommands.NEWTVWISH_EMAIL.ToString() + "//"; parameter += "TITLE=" + mymessage.title; Log.Debug("LIST: parameter=" + parameter); if (Main_GUI.Instance == null) { Log.Error("Fatal Error: Main_GUI instance did not exist in Result_GUI case2 - going back"); return; } Main_GUI.Instance.Parameter = parameter; Main_GUI.Instance.TvWishListQuickMenu = true; if (PreviousModel == EDIT_GUI_MODEL_ID_STR) { workflowManager.NavigatePop(2); //2 stages to main } else { workflowManager.NavigatePop(1);//1 stage to main } } catch (Exception exc) { Log.Error("Create Tvwish with Title failed - Exception error " + exc.Message); } break; case (int)MenuItems.CreateTvWishViewOnly://Create TvWish with Title in ViewOnly Mode try { string parameter = Main_GUI.SkinCommands.NEWTVWISH_VIEWONLY.ToString() + "//"; parameter += "TITLE=" + mymessage.title; Log.Debug("LIST: parameter=" + parameter); if (Main_GUI.Instance == null) { Log.Error("Fatal Error: Main_GUI instance did not exist in Result_GUI case2 - going back"); return; } Main_GUI.Instance.Parameter = parameter; Main_GUI.Instance.TvWishListQuickMenu = true; if (PreviousModel == EDIT_GUI_MODEL_ID_STR) { workflowManager.NavigatePop(2); //2 stages to main } else //must be main { workflowManager.NavigatePop(1);//1 stage to main } } catch (Exception exc) { Log.Error("Create Tvwish with Title failed - Exception error " + exc.Message); } break; case (int)MenuItems.CreateTvWishAllEmail: //Create TvWish with All in Email Mode try { string parameter = Main_GUI.SkinCommands.NEWTVWISH_ALL_EMAIL.ToString() + "//"; parameter += "TITLE=" + mymessage.title + "//"; parameter += "CHANNEL=" + mymessage.channel + "//"; parameter += "EPISODEPART=" + mymessage.EpisodePart + "//"; parameter += "EPISODENAME=" + mymessage.EpisodeName + "//"; parameter += "SERIESNUMBER=" + mymessage.SeriesNum + "//"; parameter += "EPISODENUMBER=" + mymessage.EpisodeNum; Log.Debug("LIST: parameter=" + parameter); if (Main_GUI.Instance == null) { Log.Error("Fatal Error: Main_GUI instance did not exist in Result_GUI case2 - going back"); return; } Main_GUI.Instance.Parameter = parameter; Main_GUI.Instance.TvWishListQuickMenu = true; if (PreviousModel == EDIT_GUI_MODEL_ID_STR) { workflowManager.NavigatePop(2); //2 stages to main } else { workflowManager.NavigatePop(1);//1 stage to main } } catch (Exception exc) { Log.Error("Create Tvwish with All failed - Exception error " + exc.Message); } break; case (int)MenuItems.CreateTvWishAllViewOnly: //Create TvWish with All in ViewOnly Mode try { string parameter = Main_GUI.SkinCommands.NEWTVWISH_ALL_VIEWONLY.ToString() + "//"; parameter += "TITLE=" + mymessage.title + "//"; parameter += "CHANNEL=" + mymessage.channel + "//"; parameter += "EPISODEPART=" + mymessage.EpisodePart + "//"; parameter += "EPISODENAME=" + mymessage.EpisodeName + "//"; parameter += "SERIESNUMBER=" + mymessage.SeriesNum + "//"; parameter += "EPISODENUMBER=" + mymessage.EpisodeNum; Log.Debug("LIST: parameter=" + parameter); if (Main_GUI.Instance == null) { Log.Error("Fatal Error: Main_GUI instance did not exist in Result_GUI case2 - going back"); return; } Main_GUI.Instance.Parameter = parameter; Main_GUI.Instance.TvWishListQuickMenu = true; if (PreviousModel == EDIT_GUI_MODEL_ID_STR) { workflowManager.NavigatePop(2); //2 stages to main } else { workflowManager.NavigatePop(1);//1 stage to main } } catch (Exception exc) { Log.Error("Create Tvwish with All failed - Exception error " + exc.Message); } break; case (int)MenuItems.DeleteMessage: //Deletemessage try { mymessages.DeleteTvMessageAt(tvMessageindex); myTvWishes.UpdateCounters(mymessages.ListAllTvMessages()); UpdateListItems(); myTvWishes.MyMessageBox(4400, 3604); //Info, message has been deleted } catch (Exception exc) { Log.Error("Deleting message failed - Exception error " + exc.Message); myTvWishes.MyMessageBox(4305, 3605); //Error, deleting message failed } break; case (int)MenuItems.DeleteSchedule: //Delete Schedule if (foundSchedule != null) //delete schedule and found item { try { foundSchedule.Delete(); Log.Debug("Schedule deleted"); mymessages.DeleteTvMessageAt(tvMessageindex); myTvWishes.UpdateCounters(mymessages.ListAllTvMessages()); UpdateListItems(); myTvWishes.MyMessageBox(4400, 3602); //Info, Schedule has been deleted } catch (Exception exc) { Log.Error("Schedule deleting failed - Exception error " + exc.Message); myTvWishes.MyMessageBox(4305, 3603); //Error, Deleting Schedule failed } } break; case (int)MenuItems.Schedule: //Schedule try { if ((_focusedMessage >= 0) && (mymessages.ListAllTvMessagesFiltered().Count > 0)) { // messagetext = mymessages.FormatMessage(mymessages.TvMessagesFiltered[_focused], _TextBoxFormat); Log.Debug("Before Schedule added - Count=" + Schedule.ListAll().Count.ToString()); Schedule schedule = layer.AddSchedule(mymessage.channel_id, mymessage.title, mymessage.start, mymessage.end, 0); if (mywish == null) { int prerecord = 5; int postrecord = 10; try { prerecord = Convert.ToInt32(myTvWishes.DefaultValues[(int)TvWishEntries.prerecord]); postrecord = Convert.ToInt32(myTvWishes.DefaultValues[(int)TvWishEntries.postrecord]); } catch (Exception exc) { Log.Debug("More: Manual schedule prerecord or postrecord could not be evaluated - Exception error " + exc.Message); } schedule.PreRecordInterval = prerecord; schedule.PostRecordInterval = postrecord; } else //use tvwish parameters { schedule.MaxAirings = mywish.i_keepepisodes; schedule.KeepDate = mywish.D_keepuntil; if (mywish.i_keepuntil > 0) { schedule.KeepDate = DateTime.Now.AddDays(mywish.i_keepuntil); Log.Debug("Keepdate based on " + mywish.i_keepuntil.ToString() + " days changed to " + schedule.KeepDate.ToString()); } schedule.KeepMethod = mywish.i_keepmethod; schedule.PostRecordInterval = mywish.i_postrecord; schedule.PreRecordInterval = mywish.i_prerecord; schedule.Priority = mywish.i_priority; schedule.RecommendedCard = mywish.i_recommendedcard; schedule.Series = mywish.b_series; //add manual recording message of type scheduled } schedule.Persist(); Log.Debug("Schedule added"); Log.Debug("Schedule added - Count="+Schedule.ListAll().Count.ToString()); // Old Bug: must not generate new message for manual scheduling (or use -1 for tvwishid) //string message = "TvWishList did schedule the program"; //mymessages.addmessage(schedule, message, mywish.t_action, mywish.name, (int)XmlMessages.MessageEvents.SCHEDULE_FOUND, mywish.tvwishid); //myTvWishes.UpdateCounters(mymessages.ListAllTvMessages()); //UpdateListItems(); myTvWishes.MyMessageBox(4400, 3600); //Info, Schedule succeeded } } catch (Exception exc) { Log.Debug("Schedule adding failed - Exception error " + exc.Message); myTvWishes.MyMessageBox(4305, 3601); //Error, Schedule adding failed } break; case (int)MenuItems.DeleteRecording: //Delete recording if (foundRecording != null) //delete recording and found item { IDialogManager mydialog = ServiceRegistration.Get<IDialogManager>(); Guid mydialogId = mydialog.ShowDialog(PluginGuiLocalizeStrings.Get(4401), PluginGuiLocalizeStrings.Get(3608).Replace(@"\n",string.Empty)+" "+mymessage.filename, DialogType.YesNoDialog, false, DialogButtonType.No); DialogCloseWatcher dialogCloseWatcher = new DialogCloseWatcher(this, mydialogId, dialogResult => { //this is watching the result of the dialog box and displaying in the Status label of the screen (do not forget to dispose) if (dialogResult.ToString() == DialogButtonType.Yes.ToString()) { try { try { File.Delete(mymessage.filename); Log.Info("File deleted: " + mymessage.filename); } catch { }//do nothing //MessageBox.Show("File deleted: " + mymessage.message); Log.Debug("tvMessageindex=" + tvMessageindex); Log.Debug("mymessages.ListAllTvMessages().Count=" + mymessages.ListAllTvMessages().Count.ToString()); Log.Debug("mymessages.ListAllTvMessagesFiltered().Count=" + mymessages.ListAllTvMessagesFiltered().Count.ToString()); xmlmessage mydeletedmessage = mymessages.GetTvMessageAtIndex(tvMessageindex); //this is the unfiltered index mydeletedmessage.type = MessageType.Deleted.ToString(); mydeletedmessage.message = String.Format(PluginGuiLocalizeStrings.Get(3651)); //File has been deleted; mydeletedmessage.created = DateTime.Now; mymessages.ReplaceTvMessageAtIndex(tvMessageindex, mydeletedmessage); //mymessages.DeleteTvMessageAt(tvMessageindex); Log.Debug("Delete Message modified"); //mymessages.DeleteTvMessageAt(tvMessageindex); foundRecording.Delete(); Log.Debug("Recording deleted"); myTvWishes.UpdateCounters(mymessages.ListAllTvMessages()); Log.Debug("Counters updated"); UpdateListItems(); myTvWishes.MyMessageBox(4400, 3606); //Info, Recording has been deleted } catch (Exception exc) { Log.Error("Recording deleting failed - Exception error " + exc.Message); myTvWishes.MyMessageBox(4305, 3607); //Error, Deleting recording failed } } return; }); }//end delete recording break; case (int)MenuItems.GotoVideo: //Goto Videos try { if (workflowManager.NavigatePopModel(VIDEO_GUI_MODEL_ID)) {// do nothing } else { workflowManager.NavigatePopToState(HOME_GUI_STATE_ID, true); workflowManager.NavigatePush(VIDEO_GUI_STATE_ID); } } catch { Log.Error("Workflow navigation to Videos failed"); } break; case (int)MenuItems.Prerecord: //prerecord _dialogMenuItemList2.Clear(); DialogHeader = PluginGuiLocalizeStrings.Get(2808); //Prerecord string[] allItemStrings = new string[] { "0", "5", "8", "10", "15", "30", PluginGuiLocalizeStrings.Get(4102) }; //Custom foreach (string itemstring in allItemStrings) { ListItem mydialogitem2 = new ListItem(); mydialogitem2.SetLabel("Name", itemstring); mydialogitem2.Command = new MethodDelegateCommand(() => { if (mydialogitem2.Labels["Name"].ToString() == PluginGuiLocalizeStrings.Get(4102)) //Custom { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); InputHeader = PluginGuiLocalizeStrings.Get(2808); //Prerecord mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); InputTextBoxSkin = mywish.prerecord; try { int k = Convert.ToInt32(InputTextBoxSkin); //Log.Debug("k=" + k.ToString()); } catch //do nothing and use default { InputTextBoxSkin = "5"; } mywish.prerecord = InputTextBoxSkin; myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); ScreenManager.ShowDialog(TVWISHLIST_RESULT_INPUT_TEXTBOX_SCREEN); } else { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); mywish.prerecord = mydialogitem2.Labels["Name"].ToString(); Log.Debug("ItemProcessing(int caseSelection): mywish.prerecord=" + mywish.prerecord); myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); Log.Debug("ItemProcessing(int caseSelection): mywish.prerecord=" + mywish.prerecord); IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); UpdateListItems(); //SelectedItemChangedprocessing(); Thread mainDialogThread = new Thread(StartMainDialogThread); mainDialogThread.Start(); } //Thread myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); }); _dialogMenuItemList2.Add(mydialogitem2); } //update for dialog skin DialogMenuItemList2.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN2); break; case (int)MenuItems.Postrecord: //postrecord _dialogMenuItemList2.Clear(); DialogHeader = PluginGuiLocalizeStrings.Get(2809); //Postrecord allItemStrings = new string[] { "0", "5", "8", "10", "15", "30", PluginGuiLocalizeStrings.Get(4102) }; //Custom foreach (string itemstring in allItemStrings) { ListItem mydialogitem2 = new ListItem(); mydialogitem2.SetLabel("Name", itemstring); mydialogitem2.Command = new MethodDelegateCommand(() => { if (mydialogitem2.Labels["Name"].ToString() == PluginGuiLocalizeStrings.Get(4102)) //Custom { IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); InputHeader = PluginGuiLocalizeStrings.Get(2809); //Postrecord mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); InputTextBoxSkin = mywish.postrecord; try { int k = Convert.ToInt32(InputTextBoxSkin); //Log.Debug("k=" + k.ToString()); } catch //do nothing and use default { InputTextBoxSkin = "5"; } mywish.postrecord = InputTextBoxSkin; myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); ScreenManager.ShowDialog(TVWISHLIST_RESULT_INPUT_TEXTBOX_SCREEN); } else { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); mywish.postrecord = mydialogitem2.Labels["Name"].ToString(); Log.Debug("ItemProcessing(int caseSelection): mywish.postrecord=" + mywish.postrecord); myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); Log.Debug("ItemProcessing(int caseSelection): mywish.postrecord=" + mywish.postrecord); IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); UpdateListItems(); //SelectedItemChangedprocessing(); Thread mainDialogThread = new Thread(StartMainDialogThread); mainDialogThread.Start(); } //Thread myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); }); _dialogMenuItemList2.Add(mydialogitem2); } //update for dialog skin DialogMenuItemList2.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN2); break; case (int)MenuItems.Keepuntil: //keepuntil _dialogMenuItemList2.Clear(); DialogHeader = PluginGuiLocalizeStrings.Get(2815); //Keep Until for (int i = 0; i <= 6; i++) { ListItem mydialogitem = new ListItem(); mydialogitem.SetLabel("Name", PluginGuiLocalizeStrings.Get(i + 2900));//Always mydialogitem.SetLabel("Index", i.ToString()); mydialogitem.Command = new MethodDelegateCommand(() => { int index = Convert.ToInt32(mydialogitem.Labels["Index"].ToString()); Log.Debug("keepuntil index = " + index.ToString()); if (index == 0) //Always { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); mywish.keepuntil = PluginGuiLocalizeStrings.Get(2900); //Always myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); UpdateListItems(); //myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); } else if (index == 1) //days after recording { DialogHeader = PluginGuiLocalizeStrings.Get(2901); // Days After Recording _dialogMenuItemList3.Clear(); allItemStrings = new string[] { "3", "5", "7", "10", "15", "30", PluginGuiLocalizeStrings.Get(4102) }; //Custom foreach (string itemstring in allItemStrings) { ListItem mydialogitem2 = new ListItem(); mydialogitem2.SetLabel("Name", itemstring); Log.Debug("mydialogitem2=" + mydialogitem2.Labels["Name"].ToString()); mydialogitem2.Command = new MethodDelegateCommand(() => { Log.Debug("mydialogitem2.Labels[Name].ToString()=" + mydialogitem2.Labels["Name"].ToString()); if (mydialogitem2.Labels["Name"].ToString() == PluginGuiLocalizeStrings.Get(4102)) //Custom { InputHeader = PluginGuiLocalizeStrings.Get(2901); // Days After Recording InputTextBoxSkin = ""; KeepuntilCode = 2920; //days after recording CaseSelection = (int)TvWishEntries.keepuntil; ScreenManager.ShowDialog(TVWISHLIST_RESULT_INPUT_TEXTBOX_SCREEN); } else { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); int j = Convert.ToInt32(mydialogitem2.Labels["Name"].ToString()); string newvalue = String.Format(PluginGuiLocalizeStrings.Get(2920), j); Log.Debug("newvalue=" + newvalue); mywish.keepuntil = newvalue; myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); } IScreenManager mycommandscreenManager2 = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager2.CloseTopmostDialog(); UpdateListItems(); //myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); }); _dialogMenuItemList3.Add(mydialogitem2); } //update for dialog skin DialogMenuItemList3.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN3); }//days after recording else if (index == 2) //weeks after recording { _dialogMenuItemList3.Clear(); DialogHeader = PluginGuiLocalizeStrings.Get(2902); // Weeks After Recording allItemStrings = new string[] { "3", "5", "7", "10", "15", "30", PluginGuiLocalizeStrings.Get(4102) }; //Custom foreach (string itemstring in allItemStrings) { ListItem mydialogitem2 = new ListItem(); mydialogitem2.SetLabel("Name", itemstring); mydialogitem2.Command = new MethodDelegateCommand(() => { if (mydialogitem2.Labels["Name"].ToString() == PluginGuiLocalizeStrings.Get(4102)) //Custom { InputHeader = PluginGuiLocalizeStrings.Get(2902); // Weeks After Recording InputTextBoxSkin = ""; KeepuntilCode = 2921; //weeks after recording CaseSelection = (int)TvWishEntries.keepuntil; ScreenManager.ShowDialog(TVWISHLIST_RESULT_INPUT_TEXTBOX_SCREEN); } else { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); int j = Convert.ToInt32(mydialogitem2.Labels["Name"].ToString()); string newvalue = String.Format(PluginGuiLocalizeStrings.Get(2921), j); //weeks mywish.keepuntil = newvalue; myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); } IScreenManager mycommandscreenManager2 = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager2.CloseTopmostDialog(); UpdateListItems(); //myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); }); _dialogMenuItemList3.Add(mydialogitem2); } //update for dialog skin DialogMenuItemList3.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN3); }//weeks after recording else if (index == 3) //months after recording { _dialogMenuItemList3.Clear(); DialogHeader = PluginGuiLocalizeStrings.Get(2903); // Months After Recording allItemStrings = new string[] { "3", "5", "7", "10", "15", "30", PluginGuiLocalizeStrings.Get(4102) }; //Custom foreach (string itemstring in allItemStrings) { ListItem mydialogitem2 = new ListItem(); mydialogitem2.SetLabel("Name", itemstring); mydialogitem2.Command = new MethodDelegateCommand(() => { if (mydialogitem2.Labels["Name"].ToString() == PluginGuiLocalizeStrings.Get(4102)) //Custom { InputHeader = PluginGuiLocalizeStrings.Get(2903); // Months After Recording InputTextBoxSkin = ""; KeepuntilCode = 2922; //months after recording CaseSelection = (int)TvWishEntries.keepuntil; ScreenManager.ShowDialog(TVWISHLIST_RESULT_INPUT_TEXTBOX_SCREEN); } else { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); int j = Convert.ToInt32(mydialogitem2.Labels["Name"].ToString()); string newvalue = String.Format(PluginGuiLocalizeStrings.Get(2922), j); //months mywish.keepuntil = newvalue; myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); } IScreenManager mycommandscreenManager2 = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager2.CloseTopmostDialog(); UpdateListItems(); //myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); }); _dialogMenuItemList3.Add(mydialogitem2); } //update for dialog skin DialogMenuItemList3.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN3); }//months after recording else if (index == 4) //date { InputHeader = PluginGuiLocalizeStrings.Get(2815) + " " + PluginGuiLocalizeStrings.Get(2923); //Keep Until date format InputTextBoxSkin = mywish.keepuntil; CaseSelection = (int)TvWishEntries.skip;// cheat with skip ScreenManager.ShowDialog(TVWISHLIST_RESULT_INPUT_TEXTBOX_SCREEN); } else if (index == 5) //until watched { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); mywish.keepuntil = PluginGuiLocalizeStrings.Get(2905); //watched myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); UpdateListItems(); //myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); } else if (index == 6) //until space needed { mywish = myTvWishes.GetAtIndex(myTvWishes.FocusedWishIndex); mywish.keepuntil = PluginGuiLocalizeStrings.Get(2906); //Space myTvWishes.ReplaceAtIndex(myTvWishes.FocusedWishIndex, mywish); UpdateListItems(); //myselectthread = new Thread(SelectItemUpdate); //myselectthread.Start(); } Log.Debug("mywish.keepuntil=" + mywish.keepuntil); IScreenManager mycommandscreenManager = ServiceRegistration.Get<IScreenManager>(); mycommandscreenManager.CloseTopmostDialog(); Log.Debug("First Dialog is closed"); }); _dialogMenuItemList2.Add(mydialogitem); } //update for dialog skin DialogMenuItemList2.FireChange(); //will now call a dialogbox with a given menu ScreenManager.ShowDialog(TVWISHLIST_RESULT_DIALOG_MENU_SCREEN2); //final check: Log.Debug("Before final check mywish.keepuntil=" + mywish.keepuntil); string checkedstring = PluginGuiLocalizeStrings.Get(4101);//defaultvalue string errormessage = ""; int days = 0; int keepMethod = 0; DateTime mydate = DateTime.Now; myTvWishes.ReverseTvWishLanguageTranslation(ref mywish); myTvWishes.ConvertString2KeepUntil(mywish.keepuntil, ref checkedstring, ref keepMethod, ref days, ref mydate, ref errormessage); myTvWishes.TvWishLanguageTranslation(ref mywish); Log.Debug("After final check mywish.keepuntil=" + mywish.keepuntil); break; } } catch (Exception exc) { Log.Error("[TVWishListMP GUI_List]:ItemSelected failed exception: " + exc.Message); } myTvWishes.ButtonActive = false; //unlock buttons }