private void OnPageLoad(NavigationContext oldContext, NavigationContext newContext) { Log.Debug("Main_GUI():OnPageLoad VIEWONLY=" + myTvWishes.ViewOnlyMode.ToString()); Log.Debug("newModelId=" + newContext.WorkflowModelId.ToString()); Log.Debug("oldModelId=" + oldContext.WorkflowModelId.ToString()); //send servername to native tvserver string mymessage = GetServerIp(); Log.Debug("ServerIpaddress=" + mymessage); TvWishListMessaging.SendTvWishListMessage(TvWishListMessaging.MessageType.OnPageLoad, mymessage); //update hostname for pipes if different server was chose TvBusinessLayer layer = new TvBusinessLayer(); Setting setting; setting = layer.GetSetting("TvWishList_MachineName", "localhost"); myPipeClient.HostName = setting.Value; //define header _active = true; if (VersionMismatch) //bye { myTvWishes.MyMessageBox(4305, 4306); //TvWishList MediaPortal Plugin Does Not Match To TvWishList TV Server Plugin TvServerLoadSettings_FAILED = true; // do not save data after version mismatch // workflowmanager is started in my message box with workflowManager.NavigatePop(1); //same as escape (takes one entry from the stack) return; //do not forget return! } Log.Debug("Previous ModelID=" + oldContext.WorkflowModelId.ToString()); if ((oldContext.WorkflowModelId == EDIT_GUI_MODEL_ID) || (oldContext.WorkflowModelId == RESULT_GUI_MODEL_ID))//TVWishList EDIT or RESULT { if ((LOCKED == false) && (TvServerLoadSettings_FAILED == false)) { //***************************************************** //Lock Tvwishes bool success = myTvWishes.LockTvWishList("TvWishListMP:Main"); if (!success) { Log.Debug("1 Lock failed"); myTvWishes.MyMessageBox(4305, 4311); //Tv wish list is being processed by another process<br>Try again later<br>If the other process hangs reboot the system or stop the tv server manually LOCKED = false; Log.Debug("1 LOCKED=" + LOCKED.ToString()); TvServerLoadSettings_FAILED = true; // workflowmanager is started in my message box with workflowManager.NavigatePop(1); //same as escape (takes one entry from the stack) return; //do not forget return! } else { LOCKED = true; Log.Debug("2 LOCKED=" + LOCKED.ToString()); } } //do not load settings } else { //***************************************************** //Lock and load Tvwishes bool success = myTvWishes.LockTvWishList("TvWishListMP:Main"); if (!success) { myTvWishes.MyMessageBox(4305, 4311); //Tv wish list is being processed by another process<br>Try again later<br>If the other process hangs reboot the system or stop the tv server manually LOCKED = false; Log.Debug("3 LOCKED=" + LOCKED.ToString()); TvServerLoadSettings_FAILED = true; // workflowmanager is started in my message box with workflowManager.NavigatePop(1); //same as escape (takes one entry from the stack) return; //do not forget return! } else { LOCKED = true; Log.Debug("4 LOCKED=" + LOCKED.ToString()); } //load MP2 data to ensure config changes are used LoadSettings(); TvserverdatabaseLoadSettings(); //MP settings at mediaportal exit } Log.Debug("_Tvwishes.Count=" + myTvWishes.ListAll().Count.ToString()); //trying new position for formatprocessing every time a page is loaded so that edit items are being updated when allitems are selected in edit window // Postprocess formats and keep only selected edit items in textboxformats (must be done after MP LoadSettings!) _TextBoxFormat_16to9_EmailFormat = TextBoxFormatConversion(_TextBoxFormat_16to9_EmailFormat_Org); _TextBoxFormat_4to3_EmailFormat = TextBoxFormatConversion(_TextBoxFormat_4to3_EmailFormat_Org); _UserEmailFormat = TextBoxFormatConversion(_UserEmailFormat_Org); _TextBoxFormat_16to9_ViewOnlyFormat = TextBoxFormatConversion(_TextBoxFormat_16to9_ViewOnlyFormat_Org); _TextBoxFormat_4to3_ViewOnlyFormat = TextBoxFormatConversion(_TextBoxFormat_4to3_ViewOnlyFormat_Org); _UserViewOnlyFormat = TextBoxFormatConversion(_UserViewOnlyFormat_Org); // end postprocessing formats UpdateControls(); UpdateListItems(); Log.Debug("OnPageLoad(): Parameter=" + Parameter); if (Parameter != String.Empty) { //start it as a thread for the dialog Thread parameterThread = new Thread(ParameterStarter); parameterThread.Start(); } }
//do not forget Wproperties in constructor! #endregion Properties for Skins #region Constructor and Dispose /// <summary> /// Constructor... this one is called by the WorkflowManager when this model is loaded due to a screen reference. /// </summary> public Main_GUI() //will be called when the screen is the first time loaded not the same as Init() !!! { Log.Debug("MainGui: Constructor called"); _instance = this; //needed to ensure transfer from static function later on // In models, properties will always be WProperty instances. When using SProperties for screen databinding, _headerProperty = new WProperty(typeof(string), "[TvWishListMP2.1000]"); _modusProperty = new WProperty(typeof(string), "[TvWishListMP2.4200]"); _statusProperty = new WProperty(typeof(string), String.Empty); _textBoxSkinProperty = new WProperty(typeof(string), String.Empty); _dialogHeaderProperty = new WProperty(typeof(string), String.Empty); _inputTextBoxSkinProperty = new WProperty(typeof(string), String.Empty); _inputHeaderProperty = new WProperty(typeof(string), String.Empty); //initialize MP1 plugin translation PluginGuiLocalizeStrings.MP2Section = "TvWishListMP2"; //Message Initialization after language mymessages = new XmlMessages(PluginGuiLocalizeStrings.Get(4900), "", false); //user defined custom DateTimeFormat will overwrite default value later //Log.Debug("[TVWishListMP GUI_List]:Init mymessages.filename=" + mymessages.filename); //TvWishes Initialization myTvWishes = new TvWishProcessing(); // get pipename from Tvserver as MPExtended uses TV1 and NativeTvserver TV2 // get hostname from tvserver for multiseat installation TvBusinessLayer layer = new TvBusinessLayer(); Setting setting; setting = layer.GetSetting("TvWishList_PipeName", "MP2TvWishListPipe"); string pipename = setting.Value; setting = layer.GetSetting("TvWishList_MachineName", "localhost"); string hostname = setting.Value; myPipeClient = new PipeClient(myTvWishes,hostname,pipename); //Format Initialization _TextBoxFormat_16to9_EmailFormat_Org = PluginGuiLocalizeStrings.Get(1900); _TextBoxFormat_16to9_EmailFormat_Org = _TextBoxFormat_16to9_EmailFormat_Org.Replace(@"\n", "\n"); _TextBoxFormat_16to9_EmailFormat_Org = _TextBoxFormat_16to9_EmailFormat_Org.Replace("<br>", "\n"); _TextBoxFormat_16to9_EmailFormat_Org = _TextBoxFormat_16to9_EmailFormat_Org.Replace("<BR>", "\n"); _TextBoxFormat_4to3_EmailFormat_Org = PluginGuiLocalizeStrings.Get(1902); _TextBoxFormat_4to3_EmailFormat_Org = _TextBoxFormat_4to3_EmailFormat_Org.Replace(@"\n", "\n"); _TextBoxFormat_4to3_EmailFormat_Org = _TextBoxFormat_4to3_EmailFormat_Org.Replace("<br>", "\n"); _TextBoxFormat_4to3_EmailFormat_Org = _TextBoxFormat_4to3_EmailFormat_Org.Replace("<BR>", "\n"); _TextBoxFormat_16to9_ViewOnlyFormat_Org = PluginGuiLocalizeStrings.Get(1901); _TextBoxFormat_16to9_ViewOnlyFormat_Org = _TextBoxFormat_16to9_ViewOnlyFormat_Org.Replace(@"\n", "\n"); _TextBoxFormat_16to9_ViewOnlyFormat_Org = _TextBoxFormat_16to9_ViewOnlyFormat_Org.Replace("<br>", "\n"); _TextBoxFormat_16to9_ViewOnlyFormat_Org = _TextBoxFormat_16to9_ViewOnlyFormat_Org.Replace("<BR>", "\n"); _TextBoxFormat_4to3_ViewOnlyFormat_Org = PluginGuiLocalizeStrings.Get(1903); _TextBoxFormat_4to3_ViewOnlyFormat_Org = _TextBoxFormat_4to3_ViewOnlyFormat_Org.Replace(@"\n", "\n"); _TextBoxFormat_4to3_ViewOnlyFormat_Org = _TextBoxFormat_4to3_ViewOnlyFormat_Org.Replace("<br>", "\n"); _TextBoxFormat_4to3_ViewOnlyFormat_Org = _TextBoxFormat_4to3_ViewOnlyFormat_Org.Replace("<BR>", "\n"); //load MP2 data LoadSettings(); //must be done after initialization of windows LoadSettingsResultGui(); //load TvwishlistFolder and filenames from TvServer LoadFromTvServer(); MpVersion = Main_GUI._instance.Version(); if (TvVersion != MpVersion) //version does not match { Log.Debug("TvVersion " + TvVersion + " does not match MpVersion " + MpVersion + " -Aborting plugin"); VersionMismatch = true; } Log.Debug("TvWishList_Mp2Version =" + MpVersion); Log.Debug("TvWishList_TvServerVersion =" + TvVersion); //send servername to native tvserver //string mymessage = GetServerIp(); //Log.Debug("ServerIpaddress=" + mymessage); //TvWishListMessaging.SendTvWishListMessage(TvWishListMessaging.MessageType.Initialization, mymessage); }
private bool LoadSettingsFromTvServer() { //get client settings from Tv server TvBusinessLayer layer = new TvBusinessLayer(); ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>(); TvWishListMP2Settings settings = settingsManager.Load<TvWishListMP2Settings>(); settings.Verbose = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxDebug", "false").Value); settings.Action = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxAction", "true").Value); settings.Active = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxActive", "false").Value); settings.AfterDays = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxAfterDays", "false").Value); settings.AfterTime = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxAfterTime", "false").Value); settings.BeforeDays = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxBeforeDay", "false").Value); settings.BeforeTime = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxBeforeTime", "false").Value); settings.Channel = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxChannel", "true").Value); settings.EpisodeName = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodeName", "false").Value); settings.EpisodeNumber = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodeNumber", "false").Value); settings.EpisodePart = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodePart", "false").Value); settings.Exclude = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxExclude", "true").Value); settings.Group = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxGroup", "true").Value); //settings.Hits = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxHits", "true").Value); settings.KeepEpisodes = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxKeepEpisodes", "false").Value); settings.KeepUntil = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxKeepUntil", "false").Value); settings.MatchType = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxMatchType", "true").Value); settings.Name = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxName", "true").Value); settings.PostRecord = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxPostrecord", "false").Value); settings.PreRecord = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxPrerecord", "false").Value); settings.Priority = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxPriority", "false").Value); settings.RecommendedCard = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxRecommendedCard", "false").Value); settings.RecordType = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxRecordtype", "true").Value); // SearchFor is always true; settings.SeriesNumber = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxSeriesNumber", "false").Value); settings.Skip = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxSkip", "true").Value); settings.UseFolderName = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxUseFolderNames", "false").Value); settings.WithinNextHours = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxRecordtype", "false").Value); settings.EpisodeCriteria = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodeCriteria", "false").Value); settings.PreferredGroup = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxPreferredGroup", "false").Value); settings.IncludeRecordings = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxIncludeRecordings", "false").Value); //modify for listview table changes settings.DisableInfoWindow = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxDisableInfoWindow", "false").Value); settings.DisableQuickMenu = Convert.ToBoolean(layer.GetSetting("TvWishList_ClientSetting_checkBoxDisableQuickMenu", "false").Value); //filenametextBox.Text=layer.GetSetting("TvWishList_ClientSetting_TvwishlistFolder", ""); //Log.Debug("[TVWishListMP] TvWishListSetup: loadsettings: " + filenametextBox.Text); settings.DateAndTimeFormat = layer.GetSetting("TvWishList_ClientSetting_DateTimeFormat", "").Value; settings.MainItemFormat = layer.GetSetting("TvWishList_ClientSetting_MainItemFormat", "").Value; settings.EmailMainTextBoxFormat = layer.GetSetting("TvWishList_ClientSetting_EmailMainFormat", "").Value; settings.EmailResultsTextBoxFormat = layer.GetSetting("TvWishList_ClientSetting_EmailResultsFormat", "").Value; settings.ResultItemFormat = layer.GetSetting("TvWishList_ClientSetting_ResultsItemFormat", "").Value; settings.ViewMainTextBoxFormat = layer.GetSetting("TvWishList_ClientSetting_ViewMainFormat", "").Value; settings.ViewResultsTextBoxFormat = layer.GetSetting("TvWishList_ClientSetting_ViewResultsFormat", "").Value; settings.TimeOut = layer.GetSetting("TvWishList_ClientSetting_TimeOut", "60").Value; settings.UserDefaultFormatsString = layer.GetSetting("TvWishList_ClientSettingDefaultFormats", "").Value; settingsManager.Save(settings); LoadSettings(); //update skin now return true; }
//TvWishProcessing myTvWishes = null; //int[] _listTranslator = new int[(int)TvWishEntries.end]; #endregion Global Variables //Skin Properties are in Base Class //reusing most code of Edit_GUI via Base Class Common_Edit_AND_ConfigDefaults #region Constructor and Dispose /// <summary> /// Constructor... this one is called by the WorkflowManager when this model is loaded due to a screen reference. /// </summary> public ConfigDefaults_GUI() { Log.Debug("ConfigDefaults_GUI: Constructor called"); _instance = this; //needed to ensure transfer from static function later on //update screens in base class this.TvWishList_Dialog_Menu_Screen = TVWISHLIST_CONFIG_DEFAULTS_DIALOG_MENU_SCREEN; this.TvWishList_Dialog_Menu2_Screen = TVWISHLIST_CONFIG_DEFAULTS_DIALOG_MENU2_SCREEN; this.TvWishList_Input_Textbox_Screen = TVWISHLIST_CONFIG_DEFAULTS_INPUT_TEXTBOX_SCREEN; // WProperties are defined already in base class //define DefaultTvWish Class myTvWishes = new TvWishProcessing(); IList<Channel> allChannels = Channel.ListAll(); IList<ChannelGroup> allChannelGroups = ChannelGroup.ListAll(); IList<RadioChannelGroup> allRadioChannelGroups = RadioChannelGroup.ListAll(); IList<Card> allCards = Card.ListAll(); TvBusinessLayer layer = new TvBusinessLayer(); Setting setting; setting = layer.GetSetting("TvWishList_ColumnSeparator", ";"); char TvWishItemSeparator = setting.Value[0]; setting = layer.GetSetting("preRecordInterval", "5"); string prerecord = setting.Value; setting = layer.GetSetting("postRecordInterval", "5"); string postrecord = setting.Value; myTvWishes.TvServerSettings(prerecord, postrecord, allChannelGroups, allRadioChannelGroups, allChannels, allCards, TvWishItemSeparator); }
private void SaveSettingsToTvServer() { //save client settings tom Tv server TvBusinessLayer layer = new TvBusinessLayer(); Setting setting; ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>(); TvWishListMP2Settings settings = settingsManager.Load<TvWishListMP2Settings>(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxDebug", "false"); setting.Value = settings.Verbose.ToString(); Log.DebugValue = settings.Verbose; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxAction", "false"); setting.Value = settings.Action.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxActive", "false"); setting.Value = settings.Active.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxAfterDays", "false"); setting.Value = settings.AfterDays.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxAfterTime", "false"); setting.Value = settings.AfterTime.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxBeforeDay", "false"); setting.Value = settings.BeforeDays.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxBeforeTime", "false"); setting.Value = settings.BeforeTime.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxChannel", "false"); setting.Value = settings.Channel.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodeName", "false"); setting.Value = settings.EpisodeName.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodeNumber", "false"); setting.Value = settings.EpisodeNumber.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodePart", "false"); setting.Value = settings.EpisodePart.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxExclude", "false"); setting.Value = settings.Exclude.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxGroup", "false"); setting.Value = settings.Group.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxKeepEpisodes", "false"); setting.Value = settings.KeepEpisodes.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxKeepUntil", "false"); setting.Value = settings.KeepUntil.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxMatchType", "false"); setting.Value = settings.MatchType.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxName", "false"); setting.Value = settings.Name.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxPostrecord", "false"); setting.Value = settings.PostRecord.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxPrerecord", "false"); setting.Value = settings.PreRecord.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxPriority", "false"); setting.Value = settings.Priority.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxRecommendedCard", "false"); setting.Value = settings.RecommendedCard.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxRecordtype", "false"); setting.Value = settings.RecordType.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxSkip", "false"); setting.Value = settings.Skip.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxSeriesNumber", "false"); setting.Value = settings.SeriesNumber.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxUseFolderNames", "false"); setting.Value = settings.UseFolderName.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxWithinNextHours", "false"); setting.Value = settings.WithinNextHours.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxEpisodeCriteria", "false"); setting.Value = settings.EpisodeCriteria.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxPreferredGroup", "false"); setting.Value = settings.PreferredGroup.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxIncludeRecordings", "false"); setting.Value = settings.IncludeRecordings.ToString(); setting.Persist(); //modify for listview table changes setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxDisableInfoWindow", "false"); setting.Value = settings.DisableInfoWindow.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_checkBoxDisableQuickMenu", "false"); setting.Value = settings.DisableQuickMenu.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_DateTimeFormat", ""); setting.Value = settings.DateAndTimeFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_MainItemFormat", ""); setting.Value = settings.MainItemFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_EmailMainFormat", ""); setting.Value = settings.EmailMainTextBoxFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_EmailResultsFormat", ""); setting.Value = settings.EmailResultsTextBoxFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_ResultsItemFormat", ""); setting.Value = settings.ResultItemFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_ViewMainFormat", ""); setting.Value = settings.ViewMainTextBoxFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_ViewResultsFormat", ""); setting.Value = settings.ViewResultsTextBoxFormat; setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_TimeOut", "60"); setting.Value = settings.TimeOut.ToString(); setting.Persist(); setting = layer.GetSetting("TvWishList_ClientSetting_DefaultFormats", ""); setting.Value = settings.UserDefaultFormatsString; setting.Persist(); }