public DropEdit(string id, string dropChance, ServerDbs sdb, GenericDatabase gdb) : base("Item edit", "cde.ico", SizeToContent.Height, ResizeMode.NoResize) { _id = id; _dropChance = dropChance; _sdb = sdb; _gdb = gdb; InitializeComponent(); _tbChance.Text = _dropChance; _tbId.Text = _id; PreviewKeyDown += new KeyEventHandler(_dropEdit_PreviewKeyDown); Loaded += delegate { _tbChance.SelectAll(); _tbChance.Focus(); }; if (sdb != null) { _buttonQuery.Click += new RoutedEventHandler(_buttonQuery_Click); } else { _buttonQuery.Visibility = Visibility.Collapsed; } }
public DisplayLabel(ServerDbs dbSource, BaseDb db) : this() { _dbSource = dbSource; _db = db; _toString = dbSource.Filename; Content = dbSource.DisplayName; if (_db != null) { _db.Attached.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null && e.NewItems.Count > 0 && e.Action == NotifyCollectionChangedAction.Replace || e.Action == NotifyCollectionChangedAction.Add) { if (e.NewItems[0] is KeyValuePair<string, object>) { var newItem = (KeyValuePair<string, object>) e.NewItems[0]; if (newItem.Key == "IsEnabled") { if (_db.Attached["IsEnabled"] == null || (bool) _db.Attached["IsEnabled"]) { _stateBrush = Brushes.Black; _stateInactiveBrush = new SolidColorBrush(Color.FromArgb(255, 98, 98, 98)); } else { _stateBrush = Brushes.Red; _stateInactiveBrush = Brushes.Red; } Grid presenter = WpfUtilities.FindParentControl<Grid>(this); TextBox box = (TextBox)presenter.Children[2]; if (box.Text == "Visible") { Foreground = _stateBrush; } else { Foreground = _stateInactiveBrush; } } } } }; } }
public SelectFromDialog(Table<int, ReadableTuple<int>> table, ServerDbs db, string text) : base("Select item in [" + db.Filename + "]", "cde.ico", SizeToContent.Manual, ResizeMode.CanResize) { InitializeComponent(); Extensions.SetMinimalSize(this); _unclickableBorder.Init(_cbSubMenu); DbAttribute attId = table.AttributeList.PrimaryAttribute; DbAttribute attDisplay = table.AttributeList.Attributes.FirstOrDefault(p => p.IsDisplayAttribute) ?? table.AttributeList.Attributes[1]; Extensions.GenerateListViewTemplate(_listView, new ListViewDataTemplateHelper.GeneralColumnInfo[] { new ListViewDataTemplateHelper.GeneralColumnInfo {Header = attId.DisplayName, DisplayExpression = "[" + attId.Index + "]", SearchGetAccessor = attId.AttributeName, FixedWidth = 60, TextAlignment = TextAlignment.Right, ToolTipBinding = "[" + attId.Index + "]"}, new ListViewDataTemplateHelper.RangeColumnInfo {Header = attDisplay.DisplayName, DisplayExpression = "[" + attDisplay.Index + "]", SearchGetAccessor = attDisplay.AttributeName, IsFill = true, ToolTipBinding = "[" + attDisplay.Index + "]", MinWidth = 100, TextWrapping = TextWrapping.Wrap } }, new DatabaseItemSorter(table.AttributeList), new string[] { "Deleted", "Red", "Modified", "Green", "Added", "Blue", "Normal", "Black" }); //_listView.ItemsSource = new ObservableCollection<ReadableTuple<int>>(table.FastItems); GTabSettings<int, ReadableTuple<int>> gTabSettings = new GTabSettings<int, ReadableTuple<int>>(db, null); gTabSettings.AttributeList = table.AttributeList; gTabSettings.AttId = attId; gTabSettings.AttDisplay = attDisplay; GSearchEngine<int, ReadableTuple<int>> gSearchEngine = new GSearchEngine<int, ReadableTuple<int>>(db, gTabSettings); var attributes = new DbAttribute[] { attId, attDisplay }.Concat(table.AttributeList.Attributes.Skip(2).Where(p => p.IsSearchable != null)).ToList(); if (attributes.Count % 2 != 0) { attributes.Add(null); } gSearchEngine.SetAttributes(attributes); gSearchEngine.SetSettings(attId, true); gSearchEngine.SetSettings(attDisplay, true); gSearchEngine.Init(_gridSearchContent, _searchTextBox, _listView, table); _searchTextBox.GotFocus += new RoutedEventHandler(_searchTextBox_GotFocus); _searchTextBox.LostFocus += new RoutedEventHandler(_searchTextBox_LostFocus); _buttonOpenSubMenu.Click += new RoutedEventHandler(_buttonOpenSubMenu_Click); _listView.MouseDoubleClick += new MouseButtonEventHandler(_listView_MouseDoubleClick); Loaded += delegate { gSearchEngine.Filter(this); }; bool first = true; gSearchEngine.FilterFinished += delegate { if (!first) return; try { int ival; if (Int32.TryParse(text, out ival)) { _listView.Dispatch(delegate { _listView.SelectedItem = table.TryGetTuple(ival); TokeiLibrary.WPF.Extensions.ScrollToCenterOfView(_listView, _listView.SelectedItem); }); } } finally { first = false; } }; }
private bool Equals(ServerDbs other) { return string.Equals(_filename, other._filename); }
private bool Equals(ServerDbs other) { return(string.Equals(_filename, other._filename)); }
public static string DetectPath(ServerDbs toString, bool allowAlernative = true) { if (File.Exists(toString)) return toString; string path = _getInCurrentPath(toString); if (path != null) { toString.UseSubPath = true; return path; } path = _getInParentPath(toString); if (path == null && toString.AlternativeName != null && allowAlernative) { return DetectPath(toString.AlternativeName); } toString.UseSubPath = false; return path; }