Example #1
0
        private void DomNode_AttributeChanging(object sender, AttributeEventArgs e)
        {
            ITimelineObject item = e.DomNode.As <ITimelineObject>();

            if (item != null)
            {
                if (!IsEditable(item, e.AttributeInfo))
                {
                    if (ActiveDocument.Cast <ITransactionContext>().InTransaction)
                    {
                        throw new InvalidTransactionException("timeline object can't be edited");
                    }
                    else
                    {
                        return;
                    }
                }

                // Check if a URI on a timeline reference has changed, so we can unload
                //  old document and load new document.
                if (e.AttributeInfo.Equivalent(Schema.timelineRefType.refAttribute))
                {
                    UnloadSubDocument((Uri)e.OldValue);
                    LoadSubDocument((Uri)e.NewValue);
                }
            }
        }
Example #2
0
 private void exportAsHtmlToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.ExportAsHtml();
     }
 }
        private void InitializeCommands(XmlRepository repository, IConfiguration configuration, IMenuCommandService commandService)
        {
            var activeDocument = new ActiveDocument();

            var subMenu = CreateSubMenu(activeDocument);
            commandService.AddCommand(subMenu);

            var copyGenericXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopyGenericXPath, repository, activeDocument, () => new XPathWriter(new[] {new AttributeFilter(configuration.AlwaysDisplayedAttributes)}), new CommandTextFormatter());
            commandService.AddCommand(copyGenericXPathCommand);

            var copyAbsoluteXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopyAbsoluteXPath, repository, activeDocument, () => new AbsoluteXPathWriter(new[] {new AttributeFilter(configuration.AlwaysDisplayedAttributes)}), new CommandTextFormatter());
            commandService.AddCommand(copyAbsoluteXPathCommand);

            var copyDistinctXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopyDistinctXPath, repository, activeDocument, () => new XPathWriter(new[] {new AttributeFilter(configuration.AlwaysDisplayedAttributes), new DistinctAttributeFilter(configuration.PreferredAttributeCandidates)}), new CommandTextFormatter());
            commandService.AddCommand(copyDistinctXPathCommand);

            var copySimplifiedXPathCommand = new CopyXPathCommand(Symbols.CommandIDs.CopySimplifiedXPath, repository, activeDocument, () => new SimplifiedXPathWriter(new[] { new AttributeFilter(configuration.AlwaysDisplayedAttributes) }), new TrimCommandTextFormatter());
            commandService.AddCommand(copySimplifiedXPathCommand);

            var showXPathWorkbenchCommand = new ShowXPathWorkbenchCommand(this, commandService, Symbols.CommandIDs.ShowXPathWorkbench, repository, activeDocument);
            commandService.AddCommand(showXPathWorkbenchCommand.Command);

            var copyXmlStructureCommand = new CopyXmlStructureCommand(Symbols.CommandIDs.CopyXmlStructure, repository, activeDocument, () => new XmlStructureWriter(), new CommandTextFormatter());
            commandService.AddCommand(copyXmlStructureCommand);
        }
Example #4
0
 private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.SaveAs();
     }
 }
Example #5
0
 private void tsbClose_Click(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.Close();
     }
 }
Example #6
0
        private OleMenuCommand CreateSubMenu(ActiveDocument activeDocument)
        {
            EventHandler onBeforeQuery    = (sender, args) => { ((OleMenuCommand)sender).Visible = activeDocument.IsXmlDocument; };
            var          subMenuCommandId = new CommandID(Guid.Parse(Symbols.PackageID), Symbols.MenuIDs.SubMenu);

            return(new OleMenuCommand(null, null, onBeforeQuery, subMenuCommandId));
        }
Example #7
0
        public void SetProgressBarVisibility(bool visibility)
        {
            if (this.TaskbarItemInfo != null)
            {
                // taskbar progress object
                this.TaskbarItemInfo.ProgressState = visibility ? System.Windows.Shell.TaskbarItemProgressState.Normal : System.Windows.Shell.TaskbarItemProgressState.None;
            }

            WaitReadyBrowser();
            if (ActiveDocument != null)
            {
                var cssdisplay    = visibility ? "" : "display: none;";
                var pbarcontainer = ActiveDocument.GetElementById(ScriptConsoleConfigs.ProgressBlockId);
                if (pbarcontainer.Style != null)
                {
                    if (pbarcontainer.Style.Contains("display:"))
                    {
                        pbarcontainer.Style = Regex.Replace(pbarcontainer.Style, "display:.+?;",
                                                            cssdisplay,
                                                            RegexOptions.IgnoreCase);
                    }
                    else
                    {
                        pbarcontainer.Style += cssdisplay;
                    }
                }
                else
                {
                    pbarcontainer.Style = cssdisplay;
                }
            }
        }
Example #8
0
        public List <IRoomInformations> GetAllRoomUpdatesSinceLastTimeChecked(string ServerVersion)
        {
            DateTime CurrentTime = DateTime.Now;
            FilterDefinition <BsonDocument> LastTimeCheckedFilter = Builders <BsonDocument> .Filter.Gte("LastUpdate", LastTimeChecked);

            List <BsonDocument>      ListFoundRoomDocument = RoomsCollection.Find(LastTimeCheckedFilter).ToList();
            List <IRoomInformations> ListFoundRoom         = new List <IRoomInformations>();

            foreach (BsonDocument ActiveDocument in ListFoundRoomDocument)
            {
                string RoomID             = ActiveDocument.GetValue("_id").AsObjectId.ToString();
                string RoomName           = ActiveDocument.GetValue("RoomName").AsString;
                string RoomType           = ActiveDocument.GetValue("RoomType").AsString;
                string RoomSubtype        = ActiveDocument.GetValue("RoomSubtype").AsString;
                bool   IsPlaying          = ActiveDocument.GetValue("IsPlaying").AsBoolean;
                string Password           = ActiveDocument.GetValue("Password").AsString;
                string OwnerServerIP      = ActiveDocument.GetValue("OwnerServerIP").AsString;
                int    OwnerServerPort    = ActiveDocument.GetValue("OwnerServerPort").AsInt32;
                byte   CurrentPlayerCount = (byte)ActiveDocument.GetValue("CurrentPlayerCount").AsInt32;
                byte   MinNumberOfPlayer  = (byte)ActiveDocument.GetValue("MinNumberOfPlayer").AsInt32;
                byte   MaxNumberOfPlayer  = (byte)ActiveDocument.GetValue("MaxNumberOfPlayer").AsInt32;
                bool   IsDead             = ActiveDocument.GetValue("IsDead").AsBoolean;

                IRoomInformations NewRoom = new ServerRoomInformations(RoomID, RoomName, RoomType, RoomSubtype, IsPlaying, Password,
                                                                       OwnerServerIP, OwnerServerPort, CurrentPlayerCount, MinNumberOfPlayer, MaxNumberOfPlayer, IsDead);
                ListFoundRoom.Add(NewRoom);
            }

            LastTimeChecked = CurrentTime;
            return(ListFoundRoom);
        }
Example #9
0
 void textEditorControl1_DocumentChanged(object sender, DocumentEventArgs e)
 {
     if (e.Length != 0)
     {
         ActiveDocument.DocumentEdited(this);
     }
 }
Example #10
0
 private void closeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.Close();
     }
 }
Example #11
0
 /// <summary>
 /// When we click redo
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnRedoClick(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.DoCommand(BindableCommand.Redo);
     }
 }
Example #12
0
 private void saveButton_Click(object sender, EventArgs e)
 {
     if (ActiveDocument.IsEdited)
     {
         ActiveDocument.Save(this);
     }
 }
 private void comboBox_entity_subtype_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!m_ignore_combobox_entity_sub_type_changed)
     {
         ActiveDocument.SetSelectedEntitySubType(((ComboBox)sender).SelectedIndex);
     }
 }
Example #14
0
 private void OnLineUncommentClick(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.DoCommand(BindableCommand.LineUncomment);
     }
 }
Example #15
0
 private void OnBlockCommentClick(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.DoCommand(BindableCommand.StreamComment);
     }
 }
Example #16
0
 private void closeMenuItem_Click(object sender, RoutedEventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.Close();
     }
 }
Example #17
0
 private void saveAsMenuItem_Click(object sender, RoutedEventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.SaveAs();
     }
 }
Example #18
0
        private int MatchNext(string matchText)
        {
            if (String.IsNullOrEmpty(matchText))
            {
                return(-1);
            }

            int indexOf = -1;

            try
            {
                ActiveTextArea.BeginUpdate();
                int    lineNo          = ActiveTextArea.Caret.Line;
                int    colNo           = ActiveTextArea.Caret.Column;
                int    totalNumOfLines = ActiveDocument.TotalNumberOfLines;
                string LineText        = SharpDevelopTextEditorUtilities.GetLineAsString(ActiveDocument, lineNo);
                LineText = ActiveDocument.GetText(ActiveTextArea.Caret.Offset, LineText.Length - colNo);

                indexOf = LineText.IndexOf(matchText, StringComparison.InvariantCultureIgnoreCase);
                int offset = colNo;

                if (indexOf < 0)
                {
                    offset = 0;
                    do
                    {
                        int tmpLineNo = ActiveDocument.GetNextVisibleLineAbove(lineNo, 1);
                        if (tmpLineNo == lineNo)
                        {
                            break;
                        }
                        lineNo   = tmpLineNo;
                        LineText = SharpDevelopTextEditorUtilities.GetLineAsString(ActiveDocument, lineNo);
                        indexOf  = LineText.IndexOf(matchText, StringComparison.InvariantCultureIgnoreCase);
                    }while (indexOf < 0 && lineNo < totalNumOfLines);
                }

                if (indexOf >= 0)
                {
                    ActiveTextArea.Caret.Column = 0;
                    ActiveTextArea.Caret.Line   = lineNo;

                    Point startPoint = ActiveTextArea.Caret.Position;
                    startPoint.X = indexOf + offset;
                    Point endPoint = startPoint;
                    endPoint.X = endPoint.X + matchText.Length;
                    ActiveTextArea.SelectionManager.SetSelection(startPoint, endPoint);
                    ActiveTextArea.Caret.Column = endPoint.X;
                }
                else if (lineNo == totalNumOfLines - 1)
                {
                    MessageBox.Show("Reached end of document", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            finally
            {
                ActiveTextArea.EndUpdate();
            }
            return(indexOf);
        }
Example #19
0
 /// <summary>
 /// When we click find
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnFindClick(object sender, EventArgs e)
 {
     if (ActiveDocument != null)
     {
         ActiveDocument.ShowFind();
     }
 }
Example #20
0
        public System.Windows.Forms.HtmlElement ComposeEntry(string contents, string HtmlElementType)
        {
            WaitReadyBrowser();
            var htmlElement = ActiveDocument.CreateElement(HtmlElementType);

            htmlElement.InnerHtml = ScriptOutputEmojis.Emojize(contents);
            return(htmlElement);
        }
 protected CopyCommand(int id, XmlRepository repository, ActiveDocument activeDocument, Func<IWriter> writerProvider, ICommandTextFormatter textFormatter)
 {
     _activeDocument = activeDocument;
     Repository = repository;
     Command = new OleMenuCommand(OnInvoke, null, OnBeforeQueryStatus, new CommandID(Guid.Parse(Symbols.PackageID), id));
     WriterProvider = writerProvider;
     TextFormatter = textFormatter;
 }
Example #22
0
 protected CopyCommand(int id, XmlRepository repository, ActiveDocument activeDocument, Func <IWriter> writerProvider, ICommandTextFormatter textFormatter)
 {
     Repository      = repository ?? throw new ArgumentNullException(nameof(repository));
     _activeDocument = activeDocument ?? throw new ArgumentNullException(nameof(activeDocument));
     Command         = new OleMenuCommand(OnInvoke, null, OnBeforeQueryStatus, new CommandID(Guid.Parse(Symbols.PackageID), id));
     WriterProvider  = writerProvider ?? throw new ArgumentNullException(nameof(writerProvider));
     TextFormatter   = textFormatter ?? throw new ArgumentNullException(nameof(textFormatter));
 }
Example #23
0
 public void Freeze()
 {
     WaitReadyBrowser();
     _lastDocumentBody           = ActiveDocument.CreateElement("<body>");
     _lastDocumentBody.InnerHtml = ActiveDocument.Body.InnerHtml;
     _frozen = true;
     UpdateInlineWaitAnimation();
 }
Example #24
0
        private int MatchPrev(string matchText)
        {
            if (String.IsNullOrEmpty(matchText))
            {
                return(-1);
            }

            int indexOf = -1;

            try
            {
                ActiveTextArea.BeginUpdate();
                int lineNo = ActiveTextArea.Caret.Line;
                int colNo  = ActiveTextArea.Caret.Column;

                string LineText = SharpDevelopTextEditorUtilities.GetLineAsString(ActiveDocument, lineNo);
                LineText = LineText.Substring(0, ActiveTextArea.Caret.Column);

                indexOf = LineText.LastIndexOf(matchText, StringComparison.InvariantCultureIgnoreCase);
                if (indexOf < 0)
                {
                    do
                    {
                        int tmpLineNo = ActiveDocument.GetNextVisibleLineBelow(lineNo, 1);
                        if (tmpLineNo == lineNo)
                        {
                            break;
                        }
                        lineNo   = tmpLineNo;
                        LineText = SharpDevelopTextEditorUtilities.GetLineAsString(ActiveDocument, lineNo);

                        indexOf = LineText.LastIndexOf(matchText, StringComparison.InvariantCultureIgnoreCase);
                    }while (indexOf < 0 && lineNo >= 0);
                }

                if (indexOf > 0)
                {
                    ActiveTextArea.Caret.Column = 0;
                    ActiveTextArea.Caret.Line   = lineNo;

                    Point startPoint = ActiveTextArea.Caret.Position;
                    startPoint.X = indexOf;
                    Point endPoint = startPoint;
                    endPoint.X = endPoint.X + matchText.Length;
                    ActiveTextArea.SelectionManager.SetSelection(startPoint, endPoint);
                    ActiveTextArea.Caret.Column = startPoint.X;
                }
                else if (lineNo == 0)
                {
                    MessageBox.Show("Reached start of document", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            finally
            {
                ActiveTextArea.EndUpdate();
            }
            return(indexOf);
        }
 private void SqlBulkCopy_SqlRowsCopied(object sender, SqlRowsCopiedEventArgs e)
 {
     if (CancelRequested)
     {
         e.Abort = true;
     }
     new StatusBarMessage(ActiveDocument, $"Exporting Table {currentTableIdx} of {totalTableCnt} : {sqlTableName} ({e.RowsCopied:N0} rows)");
     ActiveDocument.RefreshElapsedTime();
 }
        public ShowXPathWorkbenchCommand(Package package, int id, XmlRepository repository, ActiveDocument activeDocument)
        {
            _package        = package ?? throw new ArgumentNullException(nameof(package));
            _repository     = repository ?? throw new ArgumentNullException(nameof(repository));
            _activeDocument = activeDocument ?? throw new ArgumentNullException(nameof(activeDocument));
            var menuCommandID = new CommandID(Guid.Parse(Symbols.PackageID), id);

            Command = new OleMenuCommand(ShowToolWindow, null, OnBeforeQueryStatus, menuCommandID, PackageResources.ShowXPathWorkbenchCommandText);
        }
Example #27
0
        private void ShowClipboardHistoryHandler(object sender, ExecutedRoutedEventArgs args)
        {
            ActiveDocument.EnsurePopupClosed();

            new WindowClipboardHistory {
                Owner = this
            }
            .ShowDialog();
        }
Example #28
0
        /// <summary>
        /// Import a document and merge it into the current active model.
        /// </summary>
        public void ImportDocument()
        {
            ModelDocument doc = OpenDocument(true);

            if (doc != null)
            {
                ActiveDocument.MergeIn(doc);
            }
        }
Example #29
0
 /// <summary>
 /// Save the currently open document to a file path
 /// </summary>
 /// <param name="filePath"></param>
 /// <returns></returns>
 public bool SaveDocument(FilePath filePath)
 {
     try
     {
         ActiveDocument.SaveAs2(filePath.Path);
         return(true);
     }
     catch { }
     return(false);
 }
Example #30
0
        internal void Run(List <IBuildTarget> targets)
        {
            if (IsDirty(ActiveWindow))
            {
                SaveDocument();
            }

            ActiveDocument.SetTargets(targets);
            ActiveDocument.Run();
        }
Example #31
0
        public void ConvertTokensTo(TokenConversionType conversionType)
        {
            try
            {
                ActiveTextArea.BeginUpdate();

                StringBuilder       sb    = null;
                HighlightRuleSet    rules = ActiveDocument.HighlightingStrategy.GetRuleSet(null);
                IList <LineSegment> lines = ActiveDocument.LineSegmentCollection;
                for (int k = 0; k < lines.Count; k++)
                {
                    LineSegment segment = lines[k];
                    for (int i = 0; i < segment.Words.Count; i++)
                    {
                        TextWord word = segment.Words[i];
                        if (word.Type != TextWordType.Word)
                        {
                            continue;
                        }

                        if (rules.KeyWords[ActiveDocument, segment, word.Offset, word.Length] != null)
                        {
                            string newVal = word.Word;
                            switch (conversionType)
                            {
                            case TokenConversionType.Lower:
                                newVal = word.Word.ToLowerInvariant();
                                break;

                            case TokenConversionType.Upper:
                                newVal = word.Word.ToUpperInvariant();
                                break;

                            case TokenConversionType.Capitalize:
                                newVal = word.Word;
                                char[] chars = newVal.ToCharArray();
                                chars[0] = Char.ToUpperInvariant(newVal[0]);
                                sb       = new StringBuilder();
                                sb.Append(chars);
                                newVal = sb.ToString();
                                break;

                            default:
                                break;
                            }
                            ActiveDocument.Replace(segment.Offset + word.Offset, word.Length, newVal);
                        }
                    }
                }
            }
            finally
            {
                ActiveTextArea.EndUpdate();
            }
        }
Example #32
0
        internal void SaveFile(FileViewModelBase fileToSave, bool saveAsFlag = false)
        {
            if (fileToSave.FilePath == null || saveAsFlag)
            {
                var dlg = new SaveFileDialog();
                if (dlg.ShowDialog().GetValueOrDefault())
                {
                    fileToSave.FilePath = dlg.SafeFileName;
                }
            }

            if (fileToSave.FilePath == null)
            {
                return;
            }

            if (fileToSave is AudioFileViewModel)
            {
                // TODO : Save action
            }
            else if (fileToSave is GeneralFileViewModel)
            {
                GeneralFileViewModel file = fileToSave as GeneralFileViewModel;

                if (file.IsDirty)
                {
                    FileManager.WriteTextFile(file.FilePath, file.TextContent, Encoding.UTF8);
                }
            }
            else if (fileToSave is ImageFileViewModel)
            {
                // TODO : Save action
            }
            else if (fileToSave is JsonFileViewModel)
            {
                JsonFileViewModel file = fileToSave as JsonFileViewModel;

                if (file.IsDirty)
                {
                    FileManager.WriteTextFile(file.FilePath, file.DocumentText, Encoding.UTF8);
                }
            }
            else if (fileToSave is SaveFileViewModel)
            {
                // TODO : Save action
            }
            else if (fileToSave is ScriptFileViewModel)
            {
                // TODO : Save action
            }

            ActiveDocument.IsDirty = false;
            ActiveDocument.OnAfterSave(null);
        }
 public ShowXPathWorkbenchCommand(Package package, IMenuCommandService commandService, int id, XmlRepository repository, ActiveDocument activeDocument)
 {
     _package = package;
     _repository = repository;
     _activeDocument = activeDocument;
     if(commandService == null)
     {
         throw new ArgumentNullException(nameof(commandService));
     }
     var menuCommandID = new CommandID(Guid.Parse(Symbols.PackageID), id);
     Command = new OleMenuCommand(ShowToolWindow, null, OnBeforeQueryStatus, menuCommandID, PackageResources.ShowXPathWorkbenchCommandText);
 }
 private OleMenuCommand CreateSubMenu(ActiveDocument activeDocument)
 {
     EventHandler onBeforeQuery = (sender, args) => { ((OleMenuCommand)sender).Visible = activeDocument.IsXmlDocument; };
     var subMenuCommandId = new CommandID(Guid.Parse(Symbols.PackageID), Symbols.MenuIDs.SubMenu);
     return new OleMenuCommand(null, null, onBeforeQuery, subMenuCommandId);
 }
 public CopyXmlStructureCommand(int id, XmlRepository repository, ActiveDocument activeDocument, Func<IWriter> writerProvider, ICommandTextFormatter textFormatter)
     : base(id, repository, activeDocument, writerProvider, textFormatter)
 {
 }