Пример #1
0
        private void OnFileClosed()
        {
            OnPropertyChanged(nameof(IsFileOpen));
            Log.Info("File closed.");

            FileClosed?.Invoke(this, EventArgs.Empty);
        }
Пример #2
0
        public override void CloseIfAllViewsClosed()
        {
            if (registeredViews.Count == 0)
            {
                bool wasDirty = this.IsDirty;
                FileService.OpenedFileClosed(this);

                FileClosed.RaiseEvent(this, EventArgs.Empty);

                if (fileChangeWatcher != null)
                {
                    fileChangeWatcher.Dispose();
                    fileChangeWatcher = null;
                }

                if (wasDirty)
                {
                    // We discarded some information when closing the file,
                    // so we need to re-parse it.
                    if (System.IO.File.Exists(this.FileName))
                    {
                        ParserService.BeginParse(this.FileName);
                    }
                    else
                    {
                        ParserService.ClearParseInformation(this.FileName);
                    }
                }
            }
        }
 private void StopTrackingOldFiles(IList e)
 {
     foreach (ISEFile file in e)
     {
         if (FileClosed != null)
         {
             FileClosed.Invoke(this, new ViewPathEventArgs(file.FullPath));
         }
     }
 }
Пример #4
0
        public void CloseFile()
        {
            var localFilePath = this.filePath;

            FileClosing?.Invoke(this, new FileClosingEventArgs(localFilePath));

            this.filePath = null;
            this.memory   = null;

            FileClosed?.Invoke(this, new FileClosedEventArgs(localFilePath));
        }
Пример #5
0
        public static FileClosed GetFileClosedReport(DebuggerThread Context, uint[] Data)
        {
            // TODO: Restructure this library
            uint InvalidHandle = (uint)VsChromium.Core.Win32.Handles.NativeMethods.INVALID_HANDLE_VALUE;

            // Skip invalid file handles
            if (Data[0] == InvalidHandle)
            {
                return(null);
            }

            FileClosed Report = new FileClosed();

            Report.Handle = new IntPtr(Data[0]);

            return(Report);
        }
        /// <summary>
        /// Closes the file
        /// </summary>
        /// <param name="File">File to close</param>
        public virtual void CloseFile(FileViewModel file)
        {
            if (file != null)
            {
                var args = new FileClosingEventArgs();
                args.File = file;

                FileClosing?.Invoke(this, args);

                if (!args.Cancel)
                {
                    for (var i = OpenFiles.Count - 1; i >= 0; i--)
                    {
                        if (ReferenceEquals(OpenFiles[i], file))
                        {
                            OpenFiles[i].Dispose();

                            var openFilesCount = OpenFiles.Count;
                            try
                            {
                                OpenFiles.RemoveAt(i);
                            }
                            catch (NullReferenceException)
                            {
                                // There's been a bug in a dependency where OpenFiles.RemoveAt fails because of UI stuff.
                                // If the same exception is encountered, and the file has actually been removed, then ignore it.
                                if (openFilesCount <= OpenFiles.Count) // OpenFiles.Count should have decreased by 1. If it has not, then throw the exception.
                                {
                                    throw;
                                }
                            }
                        }
                    }

                    if (ReferenceEquals(file, SelectedFile))
                    {
                        SelectedFile = null;
                    }

                    FileClosed?.Invoke(this, new FileClosedEventArgs {
                        File = file.Model
                    });
                }
            }
        }
Пример #7
0
        public override void CloseIfAllViewsClosed()
        {
            if (registeredViews.Count == 0)
            {
                bool wasDirty = this.IsDirty;
                FileService.OpenedFileClosed(this);

                FileClosed.RaiseEvent(this, EventArgs.Empty);

                if (fileChangeWatcher != null)
                {
                    fileChangeWatcher.Dispose();
                    fileChangeWatcher = null;
                }

                if (wasDirty)
                {
                    // We discarded some information when closing the file,
                    // so we need to re-parse it.
                }
            }
        }
Пример #8
0
 public void Dispose()
 {
     Dispose(true);
     GC.SuppressFinalize(this);
     FileClosed?.Invoke(this, new FileClosedArgs(_filename));
 }
Пример #9
0
 public File()
 {
     _state = FileClosed.GetInstance();
     _state.SetContext(this);
 }
Пример #10
0
 public static void OnFileClosed()
 {
     FileClosed?.Invoke();
 }