Exemple #1
0
        public override void Save(string fileName)
        {
            OnSaving(EventArgs.Empty);
            watcher.Disable();

            if (!textAreaControl.CanSaveWithCurrentEncoding())
            {
                if (MessageService.AskQuestion("The file cannot be saved with the current encoding " +
                                               textAreaControl.Encoding.EncodingName + " without losing data." +
                                               "\nDo you want to save it using UTF-8 instead?"))
                {
                    textAreaControl.Encoding = System.Text.Encoding.UTF8;
                }
            }

            textAreaControl.SaveFile(fileName);
            if (fileName != this.FileName)
            {
                ParserService.ClearParseInformation(this.FileName ?? this.UntitledName);
                FileName = fileName;
                ParserService.ParseViewContent(this);
            }
            TitleName = Path.GetFileName(fileName);
            IsDirty   = false;

            watcher.SetWatcher(this.FileName);
            OnSaved(new SaveEventArgs(true));
        }