private void comboBox_preSet_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { recSetting = setDefSetting; } else { recSetting = null; recSetting = new RecSettingData(); Settings.GetDefRecSetting(item.ID, ref recSetting); } lastSelectIndex = comboBox_preSet.SelectedIndex; UpdateView(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static void SendAutoAdd(IBasicPgInfo item, bool NotToggle = false, EpgSearchKeyInfo key = null) { try { if (item == null) { return; } var dlg = new SearchWindow(mode: AutoAddMode.NewAdd); dlg.SetSearchKey(key ?? SendAutoAddKey(item, NotToggle)); if (item is IRecSetttingData) { var item_r = (item as IRecSetttingData); RecPresetItem recPreSet = item_r.RecSettingInfo.LookUpPreset(item_r.IsManual, true); RecSettingData recSet = recPreSet.Data; if (recPreSet.IsCustom == true && recSet.RecMode == 5) { recSet.RecMode = 1; } dlg.SetRecSetting(recSet); } dlg.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_del_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0) { MessageBox.Show("デフォルトは削除できません"); return; } else if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } else { comboBox_preSet.Items.Remove(item); comboBox_preSet.SelectedIndex = 0; SavePreset(null, null); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void button_del_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0) { MessageBox.Show("デフォルトは削除できません"); return; } else if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } else { presetList.Remove(item.ID); comboBox_preSet.Items.Remove(item); lastSelectIndex = -1; comboBox_preSet.SelectedIndex = 0; SavePreset(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static void SendAutoAdd(IBasicPgInfo item, bool NotToggle = false) { try { if (item == null) { return; } var dlg = new SearchWindow(); dlg.SetViewMode(SearchWindow.SearchMode.NewAdd); EpgSearchKeyInfo key = Settings.Instance.DefSearchKey.Clone(); key.andKey = TrimEpgKeyword(item.DataTitle, NotToggle); key.regExpFlag = 0; key.serviceList.Clear(); key.serviceList.Add((Int64)item.Create64Key()); dlg.SetSearchKey(key); if (item is IRecSetttingData) { var item_r = (item as IRecSetttingData); RecPresetItem recPreSet = item_r.RecSettingInfo.LookUpPreset(item_r.IsManual, true); RecSettingData recSet = recPreSet.RecPresetData; if (recPreSet.IsCustom == true && recSet.RecMode == 5) { recSet.RecMode = 1; } dlg.SetRecSetting(recSet); } dlg.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static RecPresetItem LookUpPreset(this RecSettingData data, IEnumerable <RecPresetItem> refdata, bool IsManual = false, bool CopyData = false) { RecPresetItem preset = refdata.FirstOrDefault(p1 => { return(p1.RecPresetData.EqualsSettingTo(data, IsManual)); }); return(preset == null ? new RecPresetItem("登録時", RecPresetItem.CustomID, CopyData == true ? data.Clone() : null) : preset); }
private void AddPreset(String name) { RecPresetItem newInfo = new RecPresetItem(); newInfo.DisplayName = name; newInfo.ID = 0; int index = comboBox_preSet.Items.Add(newInfo); SavePreset(newInfo, GetRecSetting()); comboBox_preSet.SelectedIndex = index; }
public UInt32 AddPreset(RecSettingData Data, string Name) { uint NextID = Presets.Count == 0 ? 0 : Presets.OrderByDescending(s => s.Key).Last().Key + 1; if (Presets.ContainsKey(NextID)) return 0xFFFFFFFF; RecPresetItem ItemInfo = new RecPresetItem() { DisplayName = Name, ID = NextID }; Presets.Add(NextID, new KeyValuePair<RecPresetItem, RecSettingData>(ItemInfo, Data)); return NextID; }
public void SetDefSetting(RecSettingData set) { RecPresetItem preCust = new RecPresetItem(); preCust.DisplayName = "登録時"; preCust.ID = 0xFFFFFFFF; int index = comboBox_preSet.Items.Add(preCust); setDefSetting = set; comboBox_preSet.SelectedIndex = index; UpdateView(set); }
public void SetRecSettingTabHeader(object sender, EventArgs e) { string preset_str = ""; if (Settings.Instance.DisplayPresetOnSearch == true) { RecPresetItem preset = recSettingView.SelectedPreset(sender == null); if (preset != null && string.IsNullOrEmpty(preset.DisplayName) == false) { preset_str = string.Format(" - {0}", preset.DisplayName); } } tabItem2.Header = "録画設定" + preset_str; }
private void SetRecSettingCmbo(RecSettingData set = null) { cmb_recSetting.Items.Clear(); cmb_recSetting.Items.AddItems(Settings.Instance.RecPresetList.DeepClone()); var item = (set ?? Settings.Instance.RecPresetList[0].Data).LookUpPreset(cmb_recSetting.Items.OfType <RecPresetItem>()); if (item == null) { item = new RecPresetItem("登録時", RecPresetItem.CustomID, set.DeepClone()); cmb_recSetting.Items.Add(item); } cmb_recSetting.SelectedItem = item; }
private void comboBox_preSet_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; UpdateView(item.ID == 0xFFFFFFFF ? setDefSetting : Settings.CreateRecSetting(item.ID)); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
//未使用。プリセット指定で予約追加ダイアログを立ち上げるときに使えると思うが、そのような処理がない。 public void SetDefSetting(UInt32 presetID) { RecPresetItem target = FindPresetItem(presetID); if (target == null) { target = comboBox_preSet.Items[0] as RecPresetItem; } recSetting = target.RecPresetData.Clone(); //強制更新 comboBox_preSet.SelectedItem = null; comboBox_preSet.SelectedItem = target; }
public RecPresetItem SelectedPreset(bool isCheckData = false, bool isDisplayManual = false) { RecPresetItem preset = comboBox_preSet.SelectedItem as RecPresetItem; if (isCheckData == true) { var preset_back = preset; preset = GetRecSetting().LookUpPreset(comboBox_preSet.Items.OfType <RecPresetItem>(), isDisplayManual); if (preset != null & comboBox_preSet.Items.Contains(preset) == false) { preset.DisplayName = (preset_back != null ? preset_back.DisplayName : "カスタム") + "*"; } } return(preset); }
private void PresetSelectChanged(RecPresetItem item, object msg) { var code = (msg as PresetSelectMode?) ?? PresetSelectMode.Normal; if (code != PresetSelectMode.SelectOnly) { if (code != PresetSelectMode.InitLoad) { recSetting = item.Data.DeepClone(); } UpdateView(); } preEdit.button_chg.IsEnabled = !item.IsCustom && CommonManager.Instance.NWMode == false; preEdit.button_del.IsEnabled = preEdit.button_chg.IsEnabled; SelectedPreset_Changed(code == PresetSelectMode.Normal); }
private void PresetEdited(List <RecPresetItem> list, PresetEdit mode) { Settings.Instance.RecPresetList = list; RecPresetItem.SavePresetList(list); SettingWindow.UpdatesInfo("録画プリセット変更"); if (CommonManager.Instance.NWMode == false) { CommonManager.CreateSrvCtrl().SendNotifyProfileUpdate(); CommonManager.MainWindow.RefreshAllViewsReserveInfo(MainWindow.UpdateViewMode.ReserveInfoNoTuner); } SetCustomPresetDisplayName(); if (mode == PresetEdit.Set) { preEdit.ChangeSelect(MatchPresetOrDefault() ?? preEdit.Items.Last(), PresetSelectMode.SelectOnly); } SelectedPreset_Changed(false); }
private void button_chg_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } AddPresetWindow setting = new AddPresetWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { setting.Owner = (Window)topWindow.RootVisual; } setting.SetMode(true); setting.SetName(item.DisplayName); if (setting.ShowDialog() == true) { String name = ""; setting.GetName(ref name); RecSettingData newSet = new RecSettingData(); GetRecSetting(ref newSet); item.DisplayName = name; presetList[item.ID] = newSet; SavePreset(); comboBox_preSet.Items.Refresh(); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void button_add_preset_Click(object sender, RoutedEventArgs e) { try { var setting = new AddPresetWindow(); setting.Owner = CommonUtil.GetTopWindow(this); if (setting.ShowDialog() == true) { RecPresetItem preCust = FindPresetItem(RecPresetItem.CustomID); int insertIndex = comboBox_preSet.Items.Count + (preCust == null ? 0 : -1); var newInfo = new RecPresetItem(setting.GetName(), 0, GetRecSetting());//IDはSavePresetですぐ割り振られる。 comboBox_preSet.Items.Insert(insertIndex, newInfo); comboBox_preSet.SelectedIndex = insertIndex; SavePreset(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void AddPreset(String name) { RecSettingData newSet = new RecSettingData(); GetRecSetting(ref newSet); RecPresetItem newInfo = new RecPresetItem(); newInfo.DisplayName = name; newInfo.ID = 0; while (presetList.ContainsKey(newInfo.ID) == true) { newInfo.ID++; } presetList.Add(newInfo.ID, newSet); int index = comboBox_preSet.Items.Add(newInfo); SavePreset(); comboBox_preSet.SelectedIndex = index; }
private void button_chg_preset_Click(object sender, RoutedEventArgs e) { try { if (comboBox_preSet.SelectedItem != null) { RecPresetItem item = comboBox_preSet.SelectedItem as RecPresetItem; if (item.ID == 0xFFFFFFFF) { MessageBox.Show("このプリセットは変更できません"); return; } AddPresetWindow setting = new AddPresetWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { setting.Owner = (Window)topWindow.RootVisual; } setting.SetMode(true); setting.PresetName = item.DisplayName; if (setting.ShowDialog() == true) { item.DisplayName = setting.PresetName; SavePreset(item, GetRecSetting()); comboBox_preSet.Items.Refresh(); comboBox_preSet.SelectedItem = null; comboBox_preSet.SelectedItem = item; } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
protected override void mcs_ctxmLoading_switch(ContextMenu ctxm, MenuItem menu) { var view = (menu.CommandParameter as EpgCmdParam).Code; //有効無効制御の追加分。予約データが無ければ無効 new List <ICommand> { EpgCmdsEx.ChgMenu, EpgCmdsEx.ShowAutoAddDialogMenu, EpgCmds.Delete, EpgCmds.DeleteAll, EpgCmds.Play }.ForEach(icmd => { if (menu.Tag == icmd) { menu.IsEnabled = dataList.Count != 0; } }); //switch使えないのでifで回す。 if (menu.Tag == EpgCmds.ChgOnOff) { if (dataList.Count == 0) { menu.Header = "簡易予約"; //予約データの有無で切り替える。 if (view == CtxmCode.SearchWindow) { RecPresetItem preset = (this.Owner as SearchWindow).GetRecSetting().LookUpPreset(); string text = preset.IsCustom == true ? "カスタム設定" : string.Format("プリセット'{0}'", preset.DisplayName); menu.ToolTip = string.Format("このダイアログの録画設定({0})で予約する", text); } else { menu.ToolTip = "プリセット'デフォルト'で予約する"; } } else { menu.Header = "予約←→無効"; menu.ToolTip = null; menu.Visibility = Visibility.Visible; if (view == CtxmCode.TunerReserveView && Settings.Instance.MenuSet.IsManualAssign.Contains(view) == false) { //簡易メニュー時は、無効列非表示のとき表示しない。 if (Settings.Instance.TunerDisplayOffReserve == false) { menu.Visibility = Visibility.Collapsed; } } } } else if (menu.Tag == EpgCmdsEx.AddMenu) { menu.IsEnabled = eventListEx.Count != 0;//未予約アイテムがあれば有効 mm.CtxmGenerateAddOnPresetItems(menu); } else if (menu.Tag == EpgCmdsEx.ChgMenu) { mcs_chgMenuOpening(menu); } else if (menu.Tag == EpgCmds.JumpReserve || menu.Tag == EpgCmds.JumpTuner) { mcs_jumpTabMenuOpening(menu); } else if (menu.Tag == EpgCmds.JumpTable) { if (view != CtxmCode.EpgView) { return; } //標準モードでは非表示。 if ((int)ctxm.Tag == 0) { menu.Visibility = Visibility.Collapsed; } } else if (menu.Tag == EpgCmdsEx.ShowAutoAddDialogMenu) { menu.IsEnabled = mm.CtxmGenerateChgAutoAdd(menu, headData as IAutoAddTargetData); } else if (menu.Tag == EpgCmds.Play) { menu.IsEnabled = false; menu.ToolTip = null; var info = headData as ReserveData; if (info != null && info.IsEnabled == true) { if (info.IsOnRec() == true) { menu.IsEnabled = true; } else { menu.ToolTip = "まだ録画が開始されていません。"; } } } else if (menu.Tag == EpgCmdsEx.OpenFolderMenu) { mm.CtxmGenerateOpenFolderItems(menu, headData as ReserveData == null ? null : dataList[0].RecSetting); } else if (menu.Tag == EpgCmdsEx.ViewMenu) { foreach (var item in menu.Items.OfType <MenuItem>().Where(item => item.Tag == EpgCmds.ViewChgMode)) { item.IsChecked = ((item.CommandParameter as EpgCmdParam).ID == (int)ctxm.Tag); } } }
private void button_add_preset_Click(object sender, RoutedEventArgs e) { try { var setting = new AddPresetWindow(); PresentationSource topWindow = PresentationSource.FromVisual(this); if (topWindow != null) { setting.Owner = (Window)topWindow.RootVisual; } if (setting.ShowDialog() == true) { RecPresetItem preCust = FindPresetItem(0xFFFFFFFF); int insertIndex = comboBox_preSet.Items.Count + (preCust == null ? 0 : -1); var newInfo = new RecPresetItem(setting.GetName(), 0, GetRecSetting());//IDはSavePresetですぐ割り振られる。 comboBox_preSet.Items.Insert(insertIndex, newInfo); comboBox_preSet.SelectedIndex = insertIndex; SavePreset(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public RecSettingView() { InitializeComponent(); try { if (Settings.Instance.NoStyle == 1) { button_add_preset.Style = null; button_chg_preset.Style = null; button_del_preset.Style = null; button_recFolderAdd.Style = null; button_recFolderChg.Style = null; button_recFolderDel.Style = null; button_bat.Style = null; button_recFolderAdd_1seg.Style = null; button_recFolderChg_1seg.Style = null; button_recFolderDel_1seg.Style = null; } Settings.GetDefRecSetting(0, ref recSetting); comboBox_recMode.DataContext = CommonManager.Instance.RecModeDictionary.Values; comboBox_tuijyu.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_pittari.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_priority.DataContext = CommonManager.Instance.PriorityDictionary.Values; tunerList.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { tunerList.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.ItemsSource = tunerList; comboBox_tuner.SelectedIndex = 0; RecPresetItem preDef = new RecPresetItem(); preDef.DisplayName = "デフォルト"; preDef.ID = 0; RecSettingData defSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref defSet); presetList.Add(0, defSet); comboBox_preSet.Items.Add(preDef); comboBox_preSet.SelectedIndex = 0; lastSelectIndex = 0; foreach (RecPresetItem info in Settings.Instance.RecPresetList) { if (presetList.ContainsKey(info.ID) == false) { RecSettingData setDatat = new RecSettingData(); Settings.GetDefRecSetting(info.ID, ref setDatat); presetList.Add(info.ID, setDatat); comboBox_preSet.Items.Add(info); } } if (CommonManager.Instance.NWMode == true) { button_bat.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public void SavePreset() { Settings.Instance.RecPresetList.Clear(); string saveID = ""; for (int i = 0; i < comboBox_preSet.Items.Count; i++) { RecPresetItem preItem = comboBox_preSet.Items[i] as RecPresetItem; if (preItem.ID == 0xFFFFFFFF) { continue; } String defName = "REC_DEF"; String defFolderName = "REC_DEF_FOLDER"; String defFolder1SegName = "REC_DEF_FOLDER_1SEG"; RecSettingData info = presetList[preItem.ID]; preItem.ID = (UInt32)i; if (preItem.ID != 0) { defName += preItem.ID.ToString(); defFolderName += preItem.ID.ToString(); defFolder1SegName += preItem.ID.ToString(); saveID += preItem.ID.ToString(); saveID += ","; } IniFileHandler.WritePrivateProfileString(defName, "SetName", preItem.DisplayName, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecMode", info.RecMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "Priority", info.Priority.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TuijyuuFlag", info.TuijyuuFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ServiceMode", info.ServiceMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PittariFlag", info.PittariFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "BatFilePath", info.BatFilePath, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "Count", info.RecFolderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.RecFolderList.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolderName, j.ToString(), info.RecFolderList[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "WritePlugIn" + j.ToString(), info.RecFolderList[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "RecNamePlugIn" + j.ToString(), info.RecFolderList[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defFolder1SegName, "Count", info.PartialRecFolder.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.PartialRecFolder.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolder1SegName, j.ToString(), info.PartialRecFolder[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "WritePlugIn" + j.ToString(), info.PartialRecFolder[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "RecNamePlugIn" + j.ToString(), info.PartialRecFolder[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defName, "SuspendMode", info.SuspendMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RebootFlag", info.RebootFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "UseMargineFlag", info.UseMargineFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "StartMargine", info.StartMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "EndMargine", info.EndMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ContinueRec", info.ContinueRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PartialRec", info.PartialRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TunerID", info.TunerID.ToString(), SettingPath.TimerSrvIniPath); Settings.Instance.RecPresetList.Add(preItem); } IniFileHandler.WritePrivateProfileString("SET", "PresetID", saveID, SettingPath.TimerSrvIniPath); Settings.SaveToXmlFile(); }
protected override void mcs_ctxmLoading_switch(ContextMenu ctxm, MenuItem menu) { var view = (menu.CommandParameter as EpgCmdParam).Code; //有効無効制御の追加分。予約データが無ければ無効 new List <ICommand> { EpgCmdsEx.ChgMenu, EpgCmds.CopyItem, EpgCmds.DeleteAll, EpgCmds.Play, EpgCmds.SetRecTag }.ForEach(icmd => { if (menu.Tag == icmd) { menu.IsEnabled = dataList.Count != 0; } }); var CheckReservableEpg = new Func <MenuItem, List <EpgEventInfo>, bool>((mi, list) => { if (list.Count != 0 && list.Count(data => data.IsReservable == true) == 0) { mi.IsEnabled = false; mi.ToolTip = "放映終了"; } return(mi.IsEnabled); }); //switch使えないのでifで回す。 if (menu.Tag == EpgCmds.ChgOnOff) { menu.IsEnabled = dataList.Count + eventListEx.Count != 0; menu.Header = view == CtxmCode.ReserveView || dataList.Count != 0 ? "予約←→無効" : "簡易予約"; //予約データの有無で切り替える。 if (dataList.Count == 0) { if (CheckReservableEpg(menu, eventListEx) == true) { RecSettingData setInfo = GetRecSetting(); if (setInfo != null) { RecPresetItem preset = setInfo.LookUpPreset(); string text = preset.IsCustom == true ? "カスタム設定" : string.Format("プリセット'{0}'", preset.DisplayName); menu.ToolTip = string.Format("現在の録画設定({0})で予約する", text); } else { menu.ToolTip = "プリセット'デフォルト'で予約する"; } } } else { menu.Visibility = Visibility.Visible; if (view == CtxmCode.TunerReserveView && Settings.Instance.MenuSet.IsManualAssign.Contains(view) == false) { //簡易メニュー時は、無効列非表示のとき表示しない。 if (Settings.Instance.TunerDisplayOffReserve == false) { menu.Visibility = Visibility.Collapsed; } } } } else if (menu.Tag == EpgCmdsEx.AddMenu) { if (CheckReservableEpg(menu, eventListAdd) == true) { menu.IsEnabled = eventListAdd.Count != 0;//未予約アイテムがあれば有効 mm.CtxmGenerateAddOnPresetItems(menu); mcs_SetSingleMenuEnabled(menu, HasList == false || IsMultiReserve == true || headData is EpgEventInfo); } var s = menu.Header as string; menu.Header = (IsMultiReserve == true ? "重複予約追加" : "予約追加") + s.Substring(s.Length - 4); } else if (menu.Tag == EpgCmdsEx.ChgMenu) { mcs_chgMenuOpening(menu, true); mcs_SetSingleMenuEnabled(menu, headData is ReserveData); } else if (menu.Tag == EpgCmds.CopyItem) { menu.IsEnabled &= !Settings.Instance.MenuSet.ShowCopyDialog || headData is ReserveData; } else if (menu.Tag == EpgCmds.Delete) { menu.IsEnabled = dataList.Any() || recinfoList.GetNoProtectedList().Any(); } else if (menu.Tag == EpgCmds.JumpReserve) { mcs_ctxmLoading_jumpTabRes(menu); menu.Visibility = mcs_GetNextReserve() != null || headDataEv == null || headDataEv.IsOver() == false ? Visibility.Visible : Visibility.Collapsed; } else if (menu.Tag == EpgCmds.JumpRecInfo) { //予約状況によってはJumpReserveと両方表示する場合もある menu.IsEnabled = headDataRec != null; menu.Visibility = menu.IsEnabled || headDataEv != null && headDataEv.IsOver() == true ? Visibility.Visible : Visibility.Collapsed; } else if (menu.Tag == EpgCmds.JumpTuner) { mcs_ctxmLoading_jumpTabRes(menu); } else if (menu.Tag == EpgCmds.JumpTable) { if (view != CtxmCode.EpgView) { mcs_ctxmLoading_jumpTabEpg(menu); return; } //標準モードでは非表示。 if ((int)ctxm.Tag == 0) { menu.Visibility = Visibility.Collapsed; } } else if (menu.Tag == EpgCmdsEx.ShowAutoAddDialogMenu) { menu.IsEnabled = mm.CtxmGenerateChgAutoAdd(menu, headData); } else if (menu.Tag == EpgCmds.Play) { //予約状況によっては予約用と録画済み用の両方表示する場合もある if ((menu.CommandParameter as EpgCmdParam).ID == 0) { menu.IsEnabled = false; var info = headData as ReserveData; if (info != null && info.IsEnabled == true) { if (info.IsOnRec() == true) { menu.IsEnabled = true; } else { menu.ToolTip = "まだ録画が開始されていません。"; } } menu.Visibility = menu.IsEnabled || (headDataEv is EpgEventInfo && !headDataEv.IsOver()) ? Visibility.Visible : Visibility.Collapsed; } else { menu.IsEnabled = headDataRec != null; menu.Visibility = menu.IsEnabled || (headDataEv is EpgEventInfo && headDataEv.IsOver()) ? Visibility.Visible : Visibility.Collapsed; } } else if (menu.Tag == EpgCmdsEx.OpenFolderMenu) { mm.CtxmGenerateOpenFolderItems(menu, headData is ReserveData ? dataList[0].RecSetting : null, headDataRec != null ? headDataRec.RecFilePath : null, !(ctxm.Tag is int && (int)(ctxm.Tag) != 2)); } else if (menu.Tag == EpgCmdsEx.ViewMenu) { foreach (var item in menu.Items.OfType <MenuItem>().Where(item => item.Tag == EpgCmds.ViewChgMode)) { item.IsChecked = ((item.CommandParameter as EpgCmdParam).ID == (int)ctxm.Tag); } } }
protected static void CopyData(RecPresetItem src, RecPresetItem dest) { dest.DisplayName = src.DisplayName; dest.ID = src.ID; dest.recPresetData = src.recPresetData.Clone();//nullのときはnullが返る。 }
private void SavePreset(object addOrChgTarget, RecSettingData addOrChgInfo) { var saveList = new List <RecSettingData>(); for (int i = 0; i < comboBox_preSet.Items.Count; i++) { RecPresetItem preItem = comboBox_preSet.Items[i] as RecPresetItem; if (preItem == addOrChgTarget) { // 追加または変更 saveList.Add(addOrChgInfo); // IDを振りなおす preItem.ID = (uint)(saveList.Count - 1); } else if (preItem.ID != 0xFFFFFFFF) { // 現在設定を維持 saveList.Add(Settings.CreateRecSetting(preItem.ID)); // IDを振りなおす preItem.ID = (uint)(saveList.Count - 1); } } if (CommonManager.Instance.NWMode) { IniFileHandler.TouchFileAsUnicode(SettingPath.TimerSrvIniPath); } string saveID = ""; for (int i = 0; i < saveList.Count; i++) { String defName = "REC_DEF"; String defFolderName = "REC_DEF_FOLDER"; String defFolder1SegName = "REC_DEF_FOLDER_1SEG"; RecSettingData info = saveList[i]; RecPresetItem preItem = comboBox_preSet.Items.OfType <RecPresetItem>().First(a => a.ID == i); if (preItem.ID != 0) { defName += preItem.ID.ToString(); defFolderName += preItem.ID.ToString(); defFolder1SegName += preItem.ID.ToString(); saveID += preItem.ID.ToString(); saveID += ","; } IniFileHandler.WritePrivateProfileString(defName, "SetName", preItem.DisplayName, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RecMode", info.RecMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "Priority", info.Priority.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TuijyuuFlag", info.TuijyuuFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ServiceMode", info.ServiceMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PittariFlag", info.PittariFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "BatFilePath", info.BatFilePath, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "Count", info.RecFolderList.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.RecFolderList.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolderName, j.ToString(), info.RecFolderList[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "WritePlugIn" + j.ToString(), info.RecFolderList[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolderName, "RecNamePlugIn" + j.ToString(), info.RecFolderList[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defFolder1SegName, "Count", info.PartialRecFolder.Count.ToString(), SettingPath.TimerSrvIniPath); for (int j = 0; j < info.PartialRecFolder.Count; j++) { IniFileHandler.WritePrivateProfileString(defFolder1SegName, j.ToString(), info.PartialRecFolder[j].RecFolder, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "WritePlugIn" + j.ToString(), info.PartialRecFolder[j].WritePlugIn, SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defFolder1SegName, "RecNamePlugIn" + j.ToString(), info.PartialRecFolder[j].RecNamePlugIn, SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString(defName, "SuspendMode", info.SuspendMode.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "RebootFlag", info.RebootFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "UseMargineFlag", info.UseMargineFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "StartMargine", info.StartMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "EndMargine", info.EndMargine.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "ContinueRec", info.ContinueRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "PartialRec", info.PartialRecFlag.ToString(), SettingPath.TimerSrvIniPath); IniFileHandler.WritePrivateProfileString(defName, "TunerID", info.TunerID.ToString(), SettingPath.TimerSrvIniPath); } IniFileHandler.WritePrivateProfileString("SET", "PresetID", saveID, SettingPath.TimerSrvIniPath); }
public RecPresetItem LookUpPreset(bool IsManual = false, bool CopyData = false, bool ResCompare = false) { RecPresetItem preset = LookUpPreset(Settings.Instance.RecPresetList, IsManual, ResCompare); return(preset == null ? new RecPresetItem("登録時", RecPresetItem.CustomID, CopyData == true ? this.DeepClone() : null) : preset); }
public void AddPreset(String name) { RecSettingData newSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref newSet); RecPresetItem newInfo = new RecPresetItem(); newInfo.DisplayName = name; newInfo.ID = 0; while (presetList.ContainsKey(newInfo.ID) == true) { newInfo.ID++; } presetList.Add(newInfo.ID, newSet); int index = comboBox_preSet.Items.Add(newInfo); SavePreset(); comboBox_preSet.SelectedIndex = index; }
public void SetDefSetting(RecSettingData set) { RecPresetItem preCust = new RecPresetItem(); preCust.DisplayName = "登録時"; preCust.ID = 0xFFFFFFFF; int index = comboBox_preSet.Items.Add(preCust); setDefSetting = set; recSetting = set; comboBox_preSet.SelectedIndex = index; UpdateView(); }
public RecSettingView() { InitializeComponent(); try { if (Settings.Instance.NoStyle == 1) { button_add_preset.Style = null; button_chg_preset.Style = null; button_del_preset.Style = null; button_recFolderAdd.Style = null; button_recFolderChg.Style = null; button_recFolderDel.Style = null; button_bat.Style = null; button_recFolderAdd_1seg.Style = null; button_recFolderChg_1seg.Style = null; button_recFolderDel_1seg.Style = null; } Settings.GetDefRecSetting(0, ref recSetting); comboBox_recMode.DataContext = CommonManager.Instance.RecModeDictionary.Values; comboBox_tuijyu.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_pittari.DataContext = CommonManager.Instance.YesNoDictionary.Values; comboBox_priority.DataContext = CommonManager.Instance.PriorityDictionary.Values; tunerList.Add(new TunerSelectInfo("自動", 0)); foreach (TunerReserveInfo info in CommonManager.Instance.DB.TunerReserveList.Values) { if (info.tunerID != 0xFFFFFFFF) { tunerList.Add(new TunerSelectInfo(info.tunerName, info.tunerID)); } } comboBox_tuner.ItemsSource = tunerList; comboBox_tuner.SelectedIndex = 0; RecPresetItem preDef = new RecPresetItem(); preDef.DisplayName = "デフォルト"; preDef.ID = 0; RecSettingData defSet = new RecSettingData(); Settings.GetDefRecSetting(0, ref defSet); presetList.Add(0, defSet); comboBox_preSet.Items.Add(preDef); comboBox_preSet.SelectedIndex = 0; lastSelectIndex = 0; foreach (RecPresetItem info in Settings.Instance.RecPresetList) { if (presetList.ContainsKey(info.ID) == false) { RecSettingData setDatat = new RecSettingData(); Settings.GetDefRecSetting(info.ID, ref setDatat); presetList.Add(info.ID, setDatat); comboBox_preSet.Items.Add(info); } } if (CommonManager.Instance.NWMode == true) { button_bat.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
protected static void CopyData(RecPresetItem src, RecPresetItem dest) { dest.DisplayName = src.DisplayName; dest.ID = src.ID; dest.recPresetData = src.recPresetData.Clone();//nullのときはnullが返る。 }
protected void mcs_chgMenuOpening(MenuItem menu) { if (menu.IsEnabled == false) { return; } var listr = dataList.OfType <IRecSetttingData>().ToList(); List <RecSettingData> recSettings = listr.RecSettingList(); var view = (menu.CommandParameter as EpgCmdParam).Code; Action <MenuItem, int> SetCheckmarkSubMenus = (subMenu, value) => { foreach (var item in subMenu.Items.OfType <MenuItem>()) { item.IsChecked = ((item.CommandParameter as EpgCmdParam).ID == value); } }; //選択アイテムが全て同じ設定の場合だけチェックを表示する foreach (var subMenu in menu.Items.OfType <MenuItem>()) { if (subMenu.Tag == EpgCmdsEx.ChgKeyEnabledMenu) { if (typeof(T).IsSubclassOf(typeof(AutoAddData)) == false) { subMenu.Visibility = Visibility.Collapsed; continue; } subMenu.Visibility = Visibility.Visible; var list = dataList.OfType <AutoAddData>().ToList(); bool?value = list.All(info => info.IsEnabled == list[0].IsEnabled) ? (bool?)list[0].IsEnabled : null; subMenu.Header = string.Format("自動登録有効 : {0}", value == null ? "*" : (value == true ? "有効" : "無効")); SetCheckmarkSubMenus(subMenu, value == true ? 0 : value == false ? 1 : int.MinValue); } else if (subMenu.Tag == EpgCmdsEx.ChgOnPresetMenu) { mm.CtxmGenerateChgOnPresetItems(subMenu); RecPresetItem pre_0 = listr[0].RecSettingInfo.LookUpPreset(listr[0].IsManual); RecPresetItem value = listr.All(data => data.RecSettingInfo.LookUpPreset(data.IsManual).ID == pre_0.ID) ? pre_0 : null; subMenu.Header = string.Format("プリセット : {0}", value == null ? "*" : value.DisplayName); SetCheckmarkSubMenus(subMenu, value == null ? int.MinValue : (int)value.ID); } else if (subMenu.Tag == EpgCmdsEx.ChgResModeMenu) { mm.CtxmGenerateChgResModeAutoAddItems(subMenu, itemCount == 1 ? dataList[0] as ReserveData : null); if (typeof(T) != typeof(ReserveData)) { subMenu.Visibility = Visibility.Collapsed; continue; } subMenu.Visibility = Visibility.Visible; var list = dataList.OfType <ReserveData>().ToList(); ReserveMode?resMode_0 = list[0].ReserveMode; ReserveMode?value = list.All(info => info.ReserveMode == resMode_0) ? resMode_0 : null; subMenu.Header = string.Format("予約モード : {0}", value == null ? "*" : CommonManager.ConvertResModeText(value)); SetCheckmarkSubMenus(subMenu, value == ReserveMode.EPG ? 0 : value == ReserveMode.Program ? 1 : int.MinValue); if (list[0].IsAutoAdded == false) { continue; } foreach (var item in subMenu.Items.OfType <MenuItem>()) { Type type = (item.CommandParameter as EpgCmdParam).Data as Type; int id = (item.CommandParameter as EpgCmdParam).ID; AutoAddData autoAdd = AutoAddData.AutoAddList(type, (uint)id); if (autoAdd != null) { item.IsChecked = autoAdd.GetReserveList().Any(info => info.ReserveID == list[0].ReserveID); } } } else if (subMenu.Tag == EpgCmds.ChgBulkRecSet) { subMenu.Visibility = (recSettings.Count < 2 ? Visibility.Collapsed : Visibility.Visible); } else if (subMenu.Tag == EpgCmds.ChgGenre) { if (typeof(T) != typeof(EpgAutoAddData)) { subMenu.Visibility = Visibility.Collapsed; continue; } subMenu.Visibility = (recSettings.Count < 2 ? Visibility.Collapsed : Visibility.Visible); } else if (subMenu.Tag == EpgCmdsEx.ChgRecmodeMenu) { byte value = recSettings.All(info => info.RecMode == recSettings[0].RecMode) ? recSettings[0].RecMode : byte.MaxValue; subMenu.Header = string.Format("録画モード : {0}", value == byte.MaxValue ? "*" : CommonManager.Instance.ConvertRecModeText(value)); SetCheckmarkSubMenus(subMenu, value); } else if (subMenu.Tag == EpgCmdsEx.ChgPriorityMenu) { byte value = recSettings.All(info => info.Priority == recSettings[0].Priority) ? recSettings[0].Priority : byte.MaxValue; subMenu.Header = string.Format("優先度 : {0}", value == byte.MaxValue ? "*" : value.ToString()); SetCheckmarkSubMenus(subMenu, value); } else if (subMenu.Tag == EpgCmdsEx.ChgRelayMenu || subMenu.Tag == EpgCmdsEx.ChgPittariMenu) { if (typeof(T) != typeof(ReserveData) && typeof(T) != typeof(EpgAutoAddData)) { subMenu.Visibility = Visibility.Collapsed; continue; } byte value; string format; if (subMenu.Tag == EpgCmdsEx.ChgRelayMenu) { value = recSettings.All(info => info.TuijyuuFlag == recSettings[0].TuijyuuFlag) ? recSettings[0].TuijyuuFlag : byte.MaxValue; format = "イベントリレー追従 : {0}"; } else { value = recSettings.All(info => info.PittariFlag == recSettings[0].PittariFlag) ? recSettings[0].PittariFlag : byte.MaxValue; format = "ぴったり(?)録画 : {0}"; } subMenu.Header = string.Format(format, value == byte.MaxValue ? "*" : CommonManager.Instance.YesNoDictionary[value].DisplayName); SetCheckmarkSubMenus(subMenu, value); subMenu.IsEnabled = listr.Any(info => info.IsManual == false); subMenu.ToolTip = (subMenu.IsEnabled != true ? "プログラム予約は対象外" : null); } else if (subMenu.Tag == EpgCmdsEx.ChgTunerMenu) { uint tunerID = recSettings.All(info => info.TunerID == recSettings[0].TunerID) ? recSettings[0].TunerID : uint.MaxValue; mm.CtxmGenerateTunerMenuItems(subMenu); subMenu.Header = string.Format("チューナー : {0}", tunerID == uint.MaxValue ? "*" : CommonManager.Instance.ConvertTunerText(tunerID)); SetCheckmarkSubMenus(subMenu, (int)tunerID); } else if (subMenu.Tag == EpgCmdsEx.ChgMarginStartMenu) { int value = recSettings.All(info => info.GetTrueMargin(true) == recSettings[0].GetTrueMargin(true)) ? recSettings[0].GetTrueMargin(true) : int.MaxValue; subMenu.Header = string.Format("開始マージン : {0} 秒", value == int.MaxValue ? "*" : value.ToString()); } else if (subMenu.Tag == EpgCmdsEx.ChgMarginEndMenu) { int value = recSettings.All(info => info.GetTrueMargin(false) == recSettings[0].GetTrueMargin(false)) ? recSettings[0].GetTrueMargin(false) : int.MaxValue; subMenu.Header = string.Format("終了マージン : {0} 秒", value == int.MaxValue ? "*" : value.ToString()); } } }