private static void InitializeHost()
        {
            var defaultHost   = WebEditor.Host;
            var decoratedHost = new RazorVersionDetectorOverridingWebHost(defaultHost);

            WebEditor.RemoveHost(defaultHost);
            WebEditor.SetHost(decoratedHost);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Initialization"/> class.
        /// </summary>
        /// <param name="webEditor">Web editor.</param>
        public Initialization(WebEditor webEditor)
        {
            if (webEditor == null)
            {
                throw new ArgumentNullException("webEditor");
            }

            this.webEditor = webEditor;
        }
Esempio n. 3
0
        private void OnRazorNamespacesFound(string[] razorNamespaces)
        {
            List <string> namespaceList = new List <string>();

            if (razorNamespaces != null)
            {
                namespaceList.AddRange(razorNamespaces);
            }
            WebEditor.DispatchOnUIThread(delegate
            {
                OnRazorNamespacesFoundMainThread(namespaceList);
            });
        }
        private void btnNewemail_Click(object sender, RoutedEventArgs e)
        {
            currentApp.Mfromname = "";
            currentApp.MfromID   = "";
            currentApp.Mtoname   = "";
            currentApp.Mcc       = "";
            currentApp.Msubject  = "";
            currentApp.Mdate     = "";
            currentApp.htmldata  = "";
            WebEditor mw = new WebEditor();

            mw.Show();
        }
        protected override void OnTextViewConnected(ITextView textView, ITextBuffer textBuffer)
        {
            var mainController = ServiceManager.GetService <TemplateMainController>(textView) ??
                                 new TemplateMainController(textView, textBuffer);

            if (textBuffer != textView.TextBuffer)
            {
                var containedLanguageHost = ContainedLanguageHost.GetHost(textView, textBuffer);
                if (containedLanguageHost != null)
                {
                    object nextFilter = containedLanguageHost.SetContainedCommandTarget(textView, mainController);
                    mainController.ChainedController = WebEditor.TranslateCommandTarget(textView, nextFilter);
                }
            }

            base.OnTextViewConnected(textView, textBuffer);
        }
Esempio n. 6
0
        private void DocumentParseComplete(object sender, DocumentParseCompleteEventArgs e)
        {
            if (_parseData == null)
            {
                return;
            }
            ParseData parseData = _parseData;
            bool      flag2;

            lock (parseData)
            {
                flag2 = _parseData.Update(e);
            }
            if (flag2)
            {
                WebEditor.DispatchOnUIThread(delegate
                {
                    DocumentParseCompleteMainThread();
                });
            }
        }
        protected void UpdateListEntriesSync(JsonCompletionContext context, IEnumerable <JsonCompletionEntry> allEntries)
        {
            if (context.Session.IsDismissed)
            {
                return;
            }

            foreach (CompletionSet curCompletionSet in (context.Session as ICompletionSession)?.CompletionSets)
            {
                if (curCompletionSet is WebCompletionSet webCompletionSet)
                {
                    WebEditor.DispatchOnUIThread(() =>
                    {
                        // only delete our completion entries
                        webCompletionSet.UpdateCompletions(s => s is SimpleCompletionEntry, allEntries);
                    });

                    // The UpdateCompletions call above may modify the collection we're enumerating. That's ok, as we're done anyways.
                    break;
                }
            }
        }
            private void InitContainedLanguage()
            {
                IVsTextLines         vsTextLines = EnsureBufferCoordinator();
                IVsContainedLanguage vsContainedLanguage;

                languageFactory.GetLanguage(hierarchy, MarkdownCodeProject.FileItemId, _textBufferCoordinator, out vsContainedLanguage);

                if (vsContainedLanguage == null)
                {
                    Logger.Log("Markdown: Couldn't get IVsContainedLanguage for " + ProjectionBuffer.IProjectionBuffer.ContentType);
                    return;
                }

                Guid langService;

                vsContainedLanguage.GetLanguageServiceID(out langService);
                vsTextLines.SetLanguageServiceID(ref langService);

                containedLanguage = vsContainedLanguage;
                IVsContainedLanguageHost legacyContainedLanguageHost = GetLegacyContainedLanguageHost();

                vsContainedLanguage.SetHost(legacyContainedLanguageHost);
                _legacyCommandTarget = new LegacyContainedLanguageCommandTarget();

                IVsTextViewFilter textViewFilter;

                _legacyCommandTarget.Create(owner.Document, vsContainedLanguage, _textBufferCoordinator, ProjectionBuffer, out textViewFilter);
                IWebContainedLanguageHost webContainedLanguageHost = legacyContainedLanguageHost as IWebContainedLanguageHost;

                webContainedLanguageHost.SetContainedCommandTarget(_legacyCommandTarget.TextView, _legacyCommandTarget.ContainedLanguageTarget);
                containedLanguage2 = (webContainedLanguageHost as IContainedLanguageHostVs);
                containedLanguage2.TextViewFilter = textViewFilter;

                ProjectionBuffer.ResetMappings();

                WebEditor.TraceEvent(1005);
            }
Esempio n. 9
0
 public static void OpenEditor(ArticleToClient SelectedArticle)
 {
     editor = new WebEditor();
     editor.SelectedArticle = SelectedArticle;
     editor.Show();
 }
Esempio n. 10
0
 public static void OpenEditor()
 {
     editor = new WebEditor();
     editor.Show();
 }
Esempio n. 11
0
        public ActionResult FileUpload(WebEditor.Models.FileUpload fileModel)
        {
            if (ModelState.IsValid)
            {
                if (!EditorDictionary.ContainsKey(fileModel.GameId))
                {
                    Logging.Log.ErrorFormat("FileUpload - game id {0} not in EditorDictionary", fileModel.GameId);
                    return new HttpStatusCodeResult(500);
                }

                bool continueSave = true;
                string ext = System.IO.Path.GetExtension(fileModel.File.FileName).ToLower();
                List<string> controlPermittedExtensions = EditorDictionary[fileModel.GameId].GetPermittedExtensions(fileModel.Key, fileModel.Attribute);
                if (fileModel.File != null
                    && fileModel.File.ContentLength > 0
                    && s_serverPermittedExtensions.Contains(ext)
                    && controlPermittedExtensions.Contains(ext))
                {
                    string filename = System.IO.Path.GetFileName(fileModel.File.FileName);
                    Logging.Log.DebugFormat("{0}: Upload file {1}", fileModel.GameId, filename);
                    string uploadPath = Services.FileManagerLoader.GetFileManager().UploadPath(fileModel.GameId);
                    
                    // Check to see if file with same name exists
                    if(System.IO.File.Exists(System.IO.Path.Combine(uploadPath, filename)))
                    {
                        FileStream existingFile = new FileStream(System.IO.Path.Combine(uploadPath, filename), FileMode.Open);
                        // if files different, rename the new file by appending a Guid to the name
                        if (!FileCompare(fileModel.File.InputStream, existingFile))
                        {
                            // rename the file by adding a number [count] at the end of filename
                            filename = EditorUtility.GetUniqueFilename(fileModel.File.FileName);                            
                        }
                        else
                            continueSave = false; // skip saving if files are identical
                        existingFile.Close();
                    }

                    if(continueSave)
                        fileModel.File.SaveAs(System.IO.Path.Combine(uploadPath, filename));

                    ModelState.Remove("AllFiles");
                    fileModel.AllFiles = GetAllFilesList(fileModel.GameId);
                    ModelState.Remove("PostedFile");
                    fileModel.PostedFile = filename;
                }
                else
                {
                    ModelState.AddModelError("File", "Invalid file type");
                }
            }
            return View(fileModel);
        }
Esempio n. 12
0
    static public void Load()
    {
        WebEditor window = GetWindow <WebEditor>();

        window.Show();
    }
Esempio n. 13
0
        private void btnreplyall_Click(object sender, RoutedEventArgs e)
        {
            WebEditor wb = new WebEditor();

            wb.Show();
        }