Пример #1
0
        public ScriptEditDialog(string text) : base("Script edit", "cde.ico", SizeToContent.Manual, ResizeMode.CanResize)
        {
            InitializeComponent();
            Extensions.SetMinimalSize(this);

            AvalonLoader.Load(_textEditor);
            AvalonLoader.SetSyntax(_textEditor, "Script");

            string script = ItemParser.Format(text, 0);

            _textEditor.Text = script;
            _textEditor.TextArea.TextEntered  += new TextCompositionEventHandler(_textArea_TextEntered);
            _textEditor.TextArea.TextEntering += new TextCompositionEventHandler(_textArea_TextEntering);

            _completionWindow = new CompletionWindow(_textEditor.TextArea);
            _li = _completionWindow.CompletionList;
            ListView lv = _li.ListBox;

            lv.SelectionMode = SelectionMode.Single;

            //Image
            Extensions.GenerateListViewTemplate(lv, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                new ListViewDataTemplateHelper.ImageColumnInfo {
                    Header = "", DisplayExpression = "Image", TextAlignment = TextAlignment.Center, FixedWidth = 22, MaxHeight = 22, SearchGetAccessor = "Commands"
                },
                new ListViewDataTemplateHelper.GeneralColumnInfo {
                    Header = "Commands", DisplayExpression = "Text", TextAlignment = TextAlignment.Left, IsFill = true, ToolTipBinding = "Description"
                }
            }, null, new string[] { }, "generateHeader", "false");

            _completionWindow.Content = null;
            _completionWindow         = null;

            WindowStartupLocation = WindowStartupLocation.CenterOwner;
        }
        public ConvertItemIdsDialog()
            : base("Convert item IDs in text", "convert.png", SizeToContent.Manual, ResizeMode.CanResize)
        {
            InitializeComponent();

            ShowInTaskbar = true;

            _tbSource.TextChanged += (e, a) => _updateDestination();

            _tbSource.PreviewKeyUp += _onCloseKey;
            _tbDest.PreviewKeyUp   += _onCloseKey;

            AvalonLoader.Load(_tbSource);
            AvalonLoader.SetSyntax(_tbSource, "Script");

            AvalonLoader.Load(_tbDest);
            AvalonLoader.SetSyntax(_tbDest, "Script");

            _tbSource.Text = Clipboard.GetText();

            try {
                _citemsDb = SdeEditor.Instance.ProjectDatabase.GetMetaTable <int>(ServerDbs.CItems);
            }
            catch {
                _citemsDb = null;
            }
        }
Пример #3
0
        public DbDebugDialog(SdeEditor editor)
            : base("Debug tables...", "warning16.png", SizeToContent.Manual, ResizeMode.CanResize)
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterOwner;
            Owner = WpfUtilities.TopWindow;

            AvalonLoader.Load(_textEditor);
            AvalonLoader.SetSyntax(_textEditor, "DebugDb");

            Log = "Database: Debugger Started...";

            DbDebugHelper.Cleared += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db) {
                Log = String.Format("Table: {0}, Message: Table data cleared.", primaryTable);
            };

            DbDebugHelper.ExceptionThrown += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db) {
                Log = String.Format("Table: {0}, File: {1}, Message: An exception occured while reading the table, continuing.", primaryTable, _getPath(subFile));
            };

            DbDebugHelper.Loaded += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db) {
                Log = String.Format("Table: {0}, File: {1}, Message: Table loaded.", primaryTable, _getPath(subFile));
            };

            DbDebugHelper.Saved += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db) {
                Log = String.Format("Table: {0}, File: {1}, Message: Table saved.", primaryTable, _getPath(subFile));
            };

            DbDebugHelper.Update += delegate(object sender, string message) {
                Log = String.Format("Database: {0}", message ?? "");
            };

            DbDebugHelper.SftpUpdate += delegate(object sender, string message) {
                Log = String.Format("Sftp: {0}", message ?? "");
            };

            DbDebugHelper.Update2 += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db, string message) {
                Log = String.Format("Table: {0}, File: {1}, Message: {2}", primaryTable, _getPath(subFile), message ?? "");
            };

            DbDebugHelper.WriteStatusUpdate += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db, string message) {
                Log = String.Format("Table: {0}, File: {1}, Message: {2}", primaryTable, _getPath(subFile), message ?? "");
            };

            DbDebugHelper.StoppedLoading += delegate(object sender, ServerDbs primaryTable, string subFile, BaseDb db) {
                Log = String.Format("Table: {0}, File: {1}, Message: Table loading has been stopped due to too many errors.", primaryTable, _getPath(subFile));
            };
        }
Пример #4
0
        public ScriptEditDialog(string text) : base("Script edit", "cde.ico", SizeToContent.Manual, ResizeMode.CanResize)
        {
            InitializeComponent();

            AvalonLoader.Load(_textEditor);
            AvalonLoader.SetSyntax(_textEditor, "Script");

            string script = DbIOFormatting.ScriptFormat(text, 0);

            _textEditor.Text = script;
            _textEditor.TextArea.TextEntered  += new TextCompositionEventHandler(_textArea_TextEntered);
            _textEditor.TextArea.TextEntering += new TextCompositionEventHandler(_textArea_TextEntering);
            _textEditor.TextChanged           += (e, a) => OnValueChanged();
            //_textEditor.TextArea.IndentationStrategy = new CSharpIndentationStrategy();

            _completionWindow            = new CompletionWindow(_textEditor.TextArea);
            _completionWindow.Background = Application.Current.Resources["TabItemBackground"] as Brush;
            _li = _completionWindow.CompletionList;
            ListView lv = _li.ListBox;

            lv.SelectionMode = SelectionMode.Single;
            lv.Background    = Application.Current.Resources["TabItemBackground"] as Brush;

            //Image
            ListViewDataTemplateHelper.GenerateListViewTemplateNew(lv, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                new ListViewDataTemplateHelper.ImageColumnInfo {
                    Header = "", DisplayExpression = "Image", TextAlignment = TextAlignment.Center, FixedWidth = 22, MaxHeight = 22, SearchGetAccessor = "Commands"
                },
                new ListViewDataTemplateHelper.GeneralColumnInfo {
                    Header = "Commands", DisplayExpression = "Text", TextAlignment = TextAlignment.Left, IsFill = true, ToolTipBinding = "Description"
                }
            }, null, new string[] { }, "generateHeader", "false");

            _completionWindow.Content = null;
            _completionWindow         = null;

            WindowStartupLocation = WindowStartupLocation.CenterOwner;

            _textEditor.Loaded += delegate {
                _textEditor.Focus();
            };
        }
Пример #5
0
        private void _loadUi()
        {
            _rcm              = new WpfRecentFiles(SdeAppConfiguration.ConfigAsker, 6, _miLoadRecent, "Server database editor - IronPython recent files");
            _rcm.FileClicked += new RecentFilesManager.RFMFileClickedEventHandler(_rcm_FileClicked);

            Binder.Bind(_textEditor, () => SdeAppConfiguration.IronPythonScript);
            Binder.Bind(_miAutocomplete, () => SdeAppConfiguration.IronPythonAutocomplete);

            AvalonLoader.Load(_textEditor);
            AvalonLoader.SetSyntax(_textEditor, "Python");
            _textEditor.TextArea.TextEntered  += new TextCompositionEventHandler(_textArea_TextEntered);
            _textEditor.TextArea.TextEntering += new TextCompositionEventHandler(_textArea_TextEntering);

            this.PreviewKeyDown += new KeyEventHandler(_ironPythonDialog_PreviewKeyDown);

            _completionWindow            = new CompletionWindow(_textEditor.TextArea);
            _completionWindow.Background = Application.Current.Resources["TabItemBackground"] as Brush;
            _li = _completionWindow.CompletionList;
            ListView lv = _li.ListBox;

            lv.SelectionMode = SelectionMode.Single;
            lv.Background    = Application.Current.Resources["TabItemBackground"] as Brush;

            //Image
            ListViewDataTemplateHelper.GenerateListViewTemplateNew(lv, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
                new ListViewDataTemplateHelper.ImageColumnInfo {
                    Header = "", DisplayExpression = "Image", TextAlignment = TextAlignment.Center, FixedWidth = 22, MaxHeight = 22, SearchGetAccessor = "Commands"
                },
                new ListViewDataTemplateHelper.GeneralColumnInfo {
                    Header = "Commands", DisplayExpression = "Text", TextAlignment = TextAlignment.Left, IsFill = true, ToolTipBinding = "Description"
                }
            }, null, new string[] { }, "generateHeader", "false");

            _completionWindow.Content  = null;
            _completionWindow          = null;
            _rowConsole.Height         = new GridLength(0);
            _buttonCloseConsole.Margin = new Thickness(0, 5, SystemParameters.HorizontalScrollBarButtonWidth + 2, 0);
            _textEditor.Drop          += new DragEventHandler(_textEditor_Drop);
        }