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. Visual Studio
  4. Visual studio add-on

Visual studio add-on

Scheduled Pinned Locked Moved Visual Studio
visual-studioquestioncsharpwpfperformance
3 Posts 2 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.
  • R Offline
    R Offline
    rastaVnuce
    wrote on last edited by
    #1

    It was pointed out to me that this is more appropriate place for this question: I'm writing a VS add-on which, on activation, is supposed to add a couple of attributes in the App.xaml. The problem I get is, when App.xaml is opened for editing, everything works fine. But, if App.xaml isn't opened the changes aren't saved. I went through the code, it still goes through it like it should, it adds the attributes like it should, it even executes the line of code that's supposed to save the changes, except... changes aren't saved This is an overview of what i do: codeState.editPoint.StartOfDocument(); string xmlText = codeState.editPoint.GetText(codeState.textDoc.EndPoint); --- add a couple of attributes using XmlDocuments --- save the changes into a memory stream codeState.editPoint.ReplaceText(codeState.textDoc.EndPoint, reader.ReadToEnd(), 0); Any ideas why?

    Where it seems there are only borderlines, Where others turn and sigh, You shall rise!

    P 1 Reply Last reply
    0
    • R rastaVnuce

      It was pointed out to me that this is more appropriate place for this question: I'm writing a VS add-on which, on activation, is supposed to add a couple of attributes in the App.xaml. The problem I get is, when App.xaml is opened for editing, everything works fine. But, if App.xaml isn't opened the changes aren't saved. I went through the code, it still goes through it like it should, it adds the attributes like it should, it even executes the line of code that's supposed to save the changes, except... changes aren't saved This is an overview of what i do: codeState.editPoint.StartOfDocument(); string xmlText = codeState.editPoint.GetText(codeState.textDoc.EndPoint); --- add a couple of attributes using XmlDocuments --- save the changes into a memory stream codeState.editPoint.ReplaceText(codeState.textDoc.EndPoint, reader.ReadToEnd(), 0); Any ideas why?

      Where it seems there are only borderlines, Where others turn and sigh, You shall rise!

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      rastaVnuce wrote:

      Any ideas why?

      If the file isn't open, you can't manipulate it like this. If you'd like to download the source to my MoXAML Power Toys[^] addin, you can find some code examples where I manipulate XAML regardless as to whether it was previously open or not (have a read of the Scrubber code to see what I mean).

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      R 1 Reply Last reply
      0
      • P Pete OHanlon

        rastaVnuce wrote:

        Any ideas why?

        If the file isn't open, you can't manipulate it like this. If you'd like to download the source to my MoXAML Power Toys[^] addin, you can find some code examples where I manipulate XAML regardless as to whether it was previously open or not (have a read of the Scrubber code to see what I mean).

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        R Offline
        R Offline
        rastaVnuce
        wrote on last edited by
        #3

        I open the file before editing, of course. What I meant was, if the file isn't open by the user, like the user's about to edit it. Only when I open the file for editing in VS and then I activate my add-on it works. If I close the file, and activate, then it doesn't (although, I open the file programatically). Nevertheless, I'll take a look at the power toys' source, thanks.

        Where it seems there are only borderlines, Where others turn and sigh, You shall rise!

        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