Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Catch events in my code when VS discovers that the file has been modified outside of the source editor

Catch events in my code when VS discovers that the file has been modified outside of the source editor

Scheduled Pinned Locked Moved C#
csharpvisual-studioquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lucienzhang
    wrote on last edited by
    #1

    I did an WinForm Applicaiton with C# code which permit the user to open a file and edit it. I want to add a functionality like VS that detect if the file openend by user is modified outside my application with a dialog : "Do you want to reload it? Yes, No?". There exist such method to do it? I think if I can catch events in my code when VS discovers that the file has been modified outside of the source editor? Thank you for your answers!!!

    D 1 Reply Last reply
    0
    • L lucienzhang

      I did an WinForm Applicaiton with C# code which permit the user to open a file and edit it. I want to add a functionality like VS that detect if the file openend by user is modified outside my application with a dialog : "Do you want to reload it? Yes, No?". There exist such method to do it? I think if I can catch events in my code when VS discovers that the file has been modified outside of the source editor? Thank you for your answers!!!

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      Have a look at the FileSystemWatcher

      Dave
      Tip: Passing values between objects using events (C#) BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
      Why are you using VB6? Do you hate yourself? (Christian Graus)

      L 1 Reply Last reply
      0
      • D DaveyM69

        Have a look at the FileSystemWatcher

        Dave
        Tip: Passing values between objects using events (C#) BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Why are you using VB6? Do you hate yourself? (Christian Graus)

        L Offline
        L Offline
        lucienzhang
        wrote on last edited by
        #3

        I have tested the FileSytemWatcher, but when I modified the file in my application, the event is catched also! so I can not distinct that the file is modified inside of my applicaion or outside?

        M 1 Reply Last reply
        0
        • L lucienzhang

          I have tested the FileSytemWatcher, but when I modified the file in my application, the event is catched also! so I can not distinct that the file is modified inside of my applicaion or outside?

          M Offline
          M Offline
          monstale
          wrote on last edited by
          #4

          Turn off the event while saving in your app. ;-)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups