private void ReloadInfoData() { listView_key.DataContext = null; resultList.Clear(); ErrCode err = CommonManager.Instance.DB.ReloadEpgAutoAddInfo(); if (err == ErrCode.CMD_ERR_CONNECT) { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); return; } if (err == ErrCode.CMD_ERR_TIMEOUT) { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); return; } if (err != ErrCode.CMD_SUCCESS) { MessageBox.Show("情報の取得でエラーが発生しました。"); return; } foreach (EpgAutoAddData info in CommonManager.Instance.DB.EpgAutoAddList.Values) { EpgAutoDataItem item = new EpgAutoDataItem(info); resultList.Add(item); } listView_key.DataContext = resultList; }
private void button_down_Click(object sender, RoutedEventArgs e) { try { if (listView_key.SelectedIndex + 1 < listView_key.Items.Count && listView_key.SelectedItem != null) { EpgAutoDataItem info1 = listView_key.SelectedItem as EpgAutoDataItem; EpgAutoDataItem info2 = listView_key.Items.GetItemAt(listView_key.SelectedIndex + 1) as EpgAutoDataItem; UInt32 tempId = info1.EpgAutoAddInfo.dataID; info1.EpgAutoAddInfo.dataID = info2.EpgAutoAddInfo.dataID; info2.EpgAutoAddInfo.dataID = tempId; List <EpgAutoAddData> addList = new List <EpgAutoAddData>(); addList.Add(info1.EpgAutoAddInfo); addList.Add(info2.EpgAutoAddInfo); if (cmd.SendChgEpgAutoAdd(addList) != 1) { MessageBox.Show("変更に失敗しました"); } } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
/// <summary> /// /// </summary> /// <param name="up0">true: up, false: down</param> void moveItem(bool up0) { EpgAutoDataItem item_Src1 = listView_key.SelectedItem as EpgAutoDataItem; if (item_Src1 == null) { return; } int index_Src1 = (resultListMoved ?? resultList).IndexOf(item_Src1); int index_Dst1 = index_Src1 - 1; if (up0 == false) { index_Dst1 = index_Src1 + 1; } if (0 <= index_Dst1 && index_Dst1 < (resultListMoved ?? resultList).Count) { resultListMoved = (resultListMoved ?? resultList).ToList(); resultListMoved.RemoveAt(index_Src1); resultListMoved.Insert(index_Dst1, item_Src1); lastAscendingSortedHeader = null; listView_key.ItemsSource = resultListMoved; button_saveItemOrder.IsEnabled = true; button_reloadItem.IsEnabled = true; textBox_ItemOrderStatus.Visibility = Visibility.Visible; } }
void saveItemOrder() { if (!this.ItemOrderNotSaved) { return; } // List <uint> dataIdList1 = new List <uint>(); foreach (EpgAutoDataItem item1 in this.resultList) { dataIdList1.Add(item1.EpgAutoAddInfo.dataID); } dataIdList1.Sort(); // List <EpgAutoAddData> addList1 = new List <EpgAutoAddData>(); for (int i1 = 0; i1 < this.resultList.Count; i1++) { EpgAutoDataItem item1 = this.resultList[i1]; item1.EpgAutoAddInfo.dataID = dataIdList1[i1]; addList1.Add(item1.EpgAutoAddInfo); } if (cmd.SendChgEpgAutoAdd(addList1) != 1) { MessageBox.Show("変更に失敗しました"); } else { this.ItemOrderNotSaved = false; } }
void saveItemOrder() { if (resultListMoved == null) { return; } // List <uint> dataIdList1 = new List <uint>(); foreach (EpgAutoDataItem item1 in resultListMoved) { dataIdList1.Add(item1.EpgAutoAddInfo.dataID); } dataIdList1.Sort(); // List <EpgAutoAddData> addList1 = new List <EpgAutoAddData>(); for (int i1 = 0; i1 < resultListMoved.Count; i1++) { EpgAutoDataItem item1 = resultListMoved[i1]; item1.EpgAutoAddInfo.dataID = dataIdList1[i1]; addList1.Add(item1.EpgAutoAddInfo); } if (CommonManager.CreateSrvCtrl().SendChgEpgAutoAdd(addList1) != ErrCode.CMD_SUCCESS) { MessageBox.Show("変更に失敗しました"); } }
private void listView_key_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { if (listView_key.SelectedItem != null) { EpgAutoDataItem info = listView_key.SelectedItem as EpgAutoDataItem; SearchWindow dlg = new SearchWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetViewMode(2); dlg.SetChgAutoAddID(info.EpgAutoAddInfo.dataID); dlg.SetSearchDefKey(info.EpgAutoAddInfo.searchInfo); dlg.SetRecInfoDef(info.EpgAutoAddInfo.recSetting); if (info.EpgAutoAddInfo.DisableSw == 0) { dlg.checkBox_Disable.IsChecked = false; } else { dlg.checkBox_Disable.IsChecked = true; } dlg.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
private void listViewItem_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { ListViewItem item1 = sender as ListViewItem; this.dragItem = item1.Content as EpgAutoDataItem; } }
private void MenuItem_Click_AutoAddContent(object sender, RoutedEventArgs e) { EpgAutoDataItem item1 = this.listView_key.SelectedItem as EpgAutoDataItem; if (item1 != null) { this.myPopupText.Text = item1.SearchInfoText; this.myPopup.IsOpen = true; } }
/***************************************************** * * 追加 * ******************************************************/ void showDialog() { if (listView_key.SelectedItem != null) { EpgAutoDataItem info = listView_key.SelectedItem as EpgAutoDataItem; SearchWindow dlg = new SearchWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetChangeModeData(info.EpgAutoAddInfo); dlg.ShowDialog(); } }
void moveItem(EpgAutoDataItem item_Src1, EpgAutoDataItem item_Dst1) { int index_Src1 = resultList.IndexOf(item_Src1); int index_Dst1 = resultList.IndexOf(item_Dst1); resultList.Remove(item_Src1); resultList.Insert(index_Dst1, item_Src1); listView_key.SelectedItem = item_Src1; listView_key.Items.Refresh(); this.ItemOrderNotSaved = true; this.gridViewSorter.resetSortParams(); }
private bool ReloadInfoData() { try { listView_key.DataContext = null; resultList.Clear(); ErrCode err = CommonManager.Instance.DB.ReloadEpgAutoAddInfo(); if (err == ErrCode.CMD_ERR_CONNECT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); }), null); return(false); } if (err == ErrCode.CMD_ERR_TIMEOUT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); }), null); return(false); } if (err != ErrCode.CMD_SUCCESS) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("情報の取得でエラーが発生しました。"); }), null); return(false); } foreach (EpgAutoAddData info in CommonManager.Instance.DB.EpgAutoAddList.Values) { EpgAutoDataItem item = new EpgAutoDataItem(info); resultList.Add(item); } listView_key.DataContext = resultList; } catch (Exception ex) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }), null); return(false); } return(true); }
private void listView_key_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (listView_key.SelectedItem != null) { EpgAutoDataItem info = listView_key.SelectedItem as EpgAutoDataItem; SearchWindow dlg = new SearchWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetViewMode(2); dlg.SetChgAutoAddID(info.EpgAutoAddInfo.dataID); dlg.SetSearchDefKey(info.EpgAutoAddInfo.searchInfo); dlg.SetRecInfoDef(info.EpgAutoAddInfo.recSetting); dlg.ShowDialog(); } }
private void listViewItem_MouseEnter(object sender, MouseEventArgs e) { if (this.dragItem != null && this.dragItem != sender) { if (Mouse.LeftButton == MouseButtonState.Released) { this.dragItem = null; } else { ListViewItem item1 = sender as ListViewItem; EpgAutoDataItem eadi1 = item1.Content as EpgAutoDataItem; this.moveItem(this.dragItem, eadi1); } } }
private void button_up_Click(object sender, RoutedEventArgs e) { if (listView_key.SelectedIndex > 0) { EpgAutoDataItem info1 = listView_key.SelectedItem as EpgAutoDataItem; EpgAutoDataItem info2 = listView_key.Items.GetItemAt(listView_key.SelectedIndex - 1) as EpgAutoDataItem; UInt32 tempId = info1.EpgAutoAddInfo.dataID; info1.EpgAutoAddInfo.dataID = info2.EpgAutoAddInfo.dataID; info2.EpgAutoAddInfo.dataID = tempId; List <EpgAutoAddData> addList = new List <EpgAutoAddData>(); addList.Add(info1.EpgAutoAddInfo); addList.Add(info2.EpgAutoAddInfo); if (cmd.SendChgEpgAutoAdd(addList) != 1) { MessageBox.Show("変更に失敗しました"); } } }
/// <summary> /// /// </summary> /// <param name="up0">true: up, false: down</param> void moveItem(itemMoveDirections moveDirection0) { EpgAutoDataItem item_Src1 = listView_key.SelectedItem as EpgAutoDataItem; if (item_Src1 == null) { return; } int index_Src1 = resultList.IndexOf(item_Src1); int index_Dst1 = index_Src1 - 1; if (moveDirection0 == itemMoveDirections.down) { index_Dst1 = index_Src1 + 1; } if (0 <= index_Dst1 && index_Dst1 < resultList.Count) { EpgAutoDataItem item_Dst1 = resultList[index_Dst1]; this.moveItem(item_Src1, item_Dst1); } }
private void button_change_Click(object sender, RoutedEventArgs e) { try { if (listView_key.SelectedItem != null) { EpgAutoDataItem info = listView_key.SelectedItem as EpgAutoDataItem; SearchWindow dlg = new SearchWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetViewMode(2); dlg.SetChgAutoAddID(info.EpgAutoAddInfo.dataID); dlg.SetSearchDefKey(info.EpgAutoAddInfo.searchInfo); dlg.SetRecInfoDef(info.EpgAutoAddInfo.recSetting); dlg.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
void showDialog() { if (listView_key.SelectedItem == null) { return; } // try { EpgAutoDataItem info = listView_key.SelectedItem as EpgAutoDataItem; SearchWindow dlg = new SearchWindow(); dlg.Owner = (Window)PresentationSource.FromVisual(this).RootVisual; dlg.SetViewMode(2); dlg.SetChgAutoAddID(info.EpgAutoAddInfo.dataID); dlg.SetSearchDefKey(info.EpgAutoAddInfo.searchInfo); dlg.SetRecInfoDef(info.EpgAutoAddInfo.recSetting); dlg.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); } }
public static string GetValuePropertyName(string key) { var obj = new EpgAutoDataItem(); if (key == CommonUtil.GetMemberName(() => obj.NextReserve)) { return CommonUtil.GetMemberName(() => obj.NextReserveValue); } else if (key == CommonUtil.GetMemberName(() => obj.MarginStart)) { return CommonUtil.GetMemberName(() => obj.MarginStartValue); } else if (key == CommonUtil.GetMemberName(() => obj.MarginEnd)) { return CommonUtil.GetMemberName(() => obj.MarginEndValue); } else { return key; } }
private bool ReloadInfoData() { try { listView_key.DataContext = null; resultList.Clear(); ErrCode err = CommonManager.Instance.DB.ReloadEpgAutoAddInfo(); if (err == ErrCode.CMD_ERR_CONNECT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("サーバー または EpgTimerSrv に接続できませんでした。"); }), null); return false; } if (err == ErrCode.CMD_ERR_TIMEOUT) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("EpgTimerSrvとの接続にタイムアウトしました。"); }), null); return false; } if (err != ErrCode.CMD_SUCCESS) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show("情報の取得でエラーが発生しました。"); }), null); return false; } foreach (EpgAutoAddData info in CommonManager.Instance.DB.EpgAutoAddList.Values) { EpgAutoDataItem item = new EpgAutoDataItem(info); resultList.Add(item); } listView_key.DataContext = resultList; } catch (Exception ex) { this.Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }), null); return false; } return true; }
//リストのチェックボックスからの呼び出し public void ChgKeyEnabledFromCheckbox(EpgAutoDataItem hitItem) { if (listView_key.SelectedItems.Contains(hitItem) == false) { listView_key.SelectedItem = hitItem; } EpgCmds.ChgOnOffKeyEnabled.Execute(listView_key, this); }