private void _loadSettingsTab() { _metaGrfViewer.SaveResourceMethod = delegate(string resources) { ProjectConfiguration.SdeEditorResources = resources; ReloadSettings(); }; SdeAppConfiguration.Bind(_cbEnableBackups, () => SdeAppConfiguration.BackupsManagerState, v => SdeAppConfiguration.BackupsManagerState = v); _metaGrfViewer.LoadResourceMethod = () => Methods.StringToList(ProjectConfiguration.SdeEditorResources); _metaGrfViewer.LoadResourcesInfo(); _loadEncoding(); _loadTxtFiles(); _loadDatabaseFiles(); }
private void _loadAutocomplete() { Binder.Bind(_cbAcIdDn, () => ProjectConfiguration.AutocompleteIdDisplayName); Binder.Bind(_cbAcUnDn, () => ProjectConfiguration.AutocompleteUnDisplayName); Binder.Bind(_cbAcIdRn, () => ProjectConfiguration.AutocompleteIdResourceName); Binder.Bind(_cbAcUnRn, () => ProjectConfiguration.AutocompleteUnResourceName); Binder.Bind(_cbAcIdDesc, () => ProjectConfiguration.AutocompleteIdDescription); Binder.Bind(_cbAcUnDesc, () => ProjectConfiguration.AutocompleteUnDescription); Binder.Bind(_tbPropFormat, () => ProjectConfiguration.AutocompleteDescriptionFormat); Binder.Bind(_cbAcNumberOfSlot, () => ProjectConfiguration.AutocompleteNumberOfSlot); Binder.Bind(_cbAcEmptyFields, () => ProjectConfiguration.AutocompleteFillOnlyEmptyFields); Binder.Bind(_tbUnDesc, () => ProjectConfiguration.AutocompleteUnDescriptionFormat); Binder.Bind(_tbDescNotSet, () => ProjectConfiguration.AutocompleteDescNotSet); Binder.Bind(_cbWriteNeutralProperty, () => ProjectConfiguration.AutocompleteNeutralProperty); Binder.Bind(_cbAcViewId, () => ProjectConfiguration.AutocompleteViewId); int index = 0; List <TextBox> boxes = new List <TextBox>(); foreach (ParameterHolderKeys property in ParameterHolderKeys.Keys) { ParameterHolderKeys key = property; Label label = new Label { Padding = new Thickness(0), Margin = new Thickness(3), Content = property.Key }; TextBox box = new TextBox { Text = SdeAppConfiguration.ConfigAsker["Autocompletion - " + key.Key, key.Key], Margin = new Thickness(3) }; WpfUtilities.SetGridPosition(label, index, 1, 0, 1); WpfUtilities.SetGridPosition(box, index, 1, 2, 1); _gridDescProp.Children.Add(label); _gridDescProp.Children.Add(box); _gridDescProp.RowDefinitions.Add(new RowDefinition { Height = new GridLength(-1, GridUnitType.Auto) }); SdeAppConfiguration.Bind(box, v => SdeAppConfiguration.ConfigAsker["Autocompletion - " + key.Key] = box.Text, p => p); index++; } index = 0; foreach (string property in ParameterHolder.Properties) { TextBox box = new TextBox { Text = ProjectConfiguration.AutocompleteProperties[index], Margin = new Thickness(3) }; TextBlock block = new TextBlock { Text = property, Margin = new Thickness(3), VerticalAlignment = VerticalAlignment.Center }; WpfUtilities.SetGridPosition(block, index / 2 + 4, 2 * (index % 2)); WpfUtilities.SetGridPosition(box, index / 2 + 4, 2 * (index % 2) + 1); boxes.Add(box); _gridDescription.Children.Add(box); _gridDescription.Children.Add(block); SdeAppConfiguration.Bind(box, v => ProjectConfiguration.AutocompleteProperties = v, q => boxes.Select(p => p.Text).ToList()); index++; } DisplayablePropertyHelper.FindAll <CheckBox>(_gridAutocomplete).ForEach(WpfUtils.AddMouseInOutEffectsBox); }
public SdeEditor() : base("Server database editor", "cde.ico", SizeToContent.Manual, ResizeMode.CanResize) { SplashDialog loading = new SplashDialog(); loading.Show(); Loaded += delegate { loading.Terminate(); }; string configFile = _parseCommandLineArguments(); GrfPath.Delete(ProjectConfiguration.DefaultFileName); if (configFile == null) { ProjectConfiguration.ConfigAsker = new ConfigAsker(ProjectConfiguration.DefaultFileName); } else if (File.Exists(configFile)) { ProjectConfiguration.ConfigAsker = new ConfigAsker(configFile); } InitializeComponent(); ShowInTaskbar = true; _asyncOperation = new AsyncOperation(_progressBar); _clientDatabase = new GenericDatabase(_metaGrf); _loadMenu(); _loadSettingsTab(); if (configFile != null) { ReloadSettings(configFile); } _loadGenericTab(); _clientDatabase.Modified += new BaseGenericDatabase.ClientDatabaseEventHandler(_clientDatabase_Modified); _cbAssociate.Checked -= new RoutedEventHandler(_cbAssociate_Checked); _cbAssociate.IsChecked = (SdeAppConfiguration.FileShellAssociated & FileAssociation.Sde) == FileAssociation.Sde; _cbAssociate.Checked += new RoutedEventHandler(_cbAssociate_Checked); ApplicationShortcut.Link(ApplicationShortcut.Undo, () => _clientDatabase.Commands.Undo(), this); ApplicationShortcut.Link(ApplicationShortcut.UndoGlobal, () => _clientDatabase.Commands.Undo(), this); ApplicationShortcut.Link(ApplicationShortcut.Redo, () => _clientDatabase.Commands.Redo(), this); ApplicationShortcut.Link(ApplicationShortcut.RedoGlobal, () => _clientDatabase.Commands.Redo(), this); ApplicationShortcut.Link(ApplicationShortcut.Search, () => _execute(v => v.Search()), this); ApplicationShortcut.Link(ApplicationShortcut.Delete, () => _execute(v => v.DeleteItems()), this); ApplicationShortcut.Link(ApplicationShortcut.Rename, () => _execute(v => v.ChangeId()), this); ApplicationShortcut.Link(ApplicationShortcut.NavigationBackward, () => _tabEngine.Undo(), this); ApplicationShortcut.Link(ApplicationShortcut.NavigationBackward2, () => _tabEngine.Redo(), this); ApplicationShortcut.Link(ApplicationShortcut.NavigationForward, () => _tabEngine.Redo(), this); ApplicationShortcut.Link(ApplicationShortcut.Change, () => _execute(v => v.ChangeId()), this); ApplicationShortcut.Link(ApplicationShortcut.Restrict, () => _execute(v => v.ShowSelectedOnly()), this); ApplicationShortcut.Link(ApplicationShortcut.CopyTo, () => _execute(v => v.CopyItemTo()), this); ApplicationShortcut.Link(ApplicationShortcut.New, () => _execute(v => v.AddNewItem()), this); ApplicationShortcut.Link(ApplicationShortcut.Save, () => _menuItemDatabaseSave_Click(this, null), this); ApplicationShortcut.Link(ApplicationShortcut.SaveAll, () => _menuItemDatabaseSaveAll_Click(this, null), this); SdeAppConfiguration.Bind(_cbStackTrace, () => Configuration.EnableDebuggerTrace, v => { Configuration.EnableDebuggerTrace = v; SdeErrorHandler.ShowStackTraceViewer(); }); _tnbUndo.SetUndo(_tabEngine); _tnbRedo.SetRedo(_tabEngine); _tmbUndo.SetUndo(_clientDatabase.Commands); _tmbRedo.SetRedo(_clientDatabase.Commands); Extensions.GenerateListViewTemplate(_debugList, new ListViewDataTemplateHelper.GeneralColumnInfo[] { new ListViewDataTemplateHelper.GeneralColumnInfo { Header = "#", DisplayExpression = "ErrorNumber", SearchGetAccessor = "ErrorNumber", FixedWidth = 35, ToolTipBinding = "ErrorNumber", TextAlignment = TextAlignment.Right }, new ListViewDataTemplateHelper.ImageColumnInfo { Header = "", DisplayExpression = "DataImage", SearchGetAccessor = "Exception", FixedWidth = 20, MaxHeight = 24 }, new ListViewDataTemplateHelper.RangeColumnInfo { Header = "Exception", DisplayExpression = "Exception", SearchGetAccessor = "Exception", IsFill = true, TextAlignment = TextAlignment.Left, ToolTipBinding = "OriginalException", TextWrapping = TextWrapping.Wrap, MinWidth = 120 }, new ListViewDataTemplateHelper.GeneralColumnInfo { Header = "Id", DisplayExpression = "Id", SearchGetAccessor = "Id", FixedWidth = 90, TextAlignment = TextAlignment.Left, ToolTipBinding = "Id", TextWrapping = TextWrapping.Wrap }, new ListViewDataTemplateHelper.GeneralColumnInfo { Header = "File", DisplayExpression = "FileName", SearchGetAccessor = "FilePath", FixedWidth = 130, TextAlignment = TextAlignment.Left, ToolTipBinding = "FilePath", TextWrapping = TextWrapping.Wrap }, new ListViewDataTemplateHelper.GeneralColumnInfo { Header = "Line", DisplayExpression = "Line", SearchGetAccessor = "Line", FixedWidth = 40, TextAlignment = TextAlignment.Left, ToolTipBinding = "Line" }, }, null, new string[] { "Added", "Blue", "Default", "Black" }); ApplicationShortcut.Link(ApplicationShortcut.Copy, () => WpfUtils.CopyContent(_debugList), _debugList); _debugItems = new ObservableCollection <DebugItemView>(); _debugList.ItemsSource = _debugItems; DbLoaderErrorHandler.ClearListeners(); DbLoaderErrorHandler.AddListener(this); _clientDatabase.PreviewReloaded += delegate { this.BeginDispatch(delegate { foreach (TabItem tabItem in _mainTabControl.Items) { tabItem.IsEnabled = true; var tabItemHeader = tabItem.Header as DisplayLabel; if (tabItemHeader != null) { tabItemHeader.ResetEnabled(); } } }); }; _clientDatabase.Reloaded += delegate { _mainTabControl.Dispatch(p => p.RaiseEvent(new SelectionChangedEventArgs(Selector.SelectionChangedEvent, new List <object>(), _mainTabControl.SelectedItem == null ? new List <object>() : new List <object> { _mainTabControl.SelectedItem }))); ServerType serverType = AllLoaders.GetServerType(); bool renewal = AllLoaders.GetIsRenewal(); string header = String.Format("Current ({0} - {1})", serverType == ServerType.RAthena ? "rA" : "Herc", renewal ? "Renewal" : "Pre-Renewal"); this.BeginDispatch(delegate { _menuItemExportDbCurrent.IsEnabled = true; _menuItemExportDbCurrent.Header = header; _menuItemExportSqlCurrent.IsEnabled = true; _menuItemExportSqlCurrent.Header = header; }); }; }