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. WPF
  4. Setting an expiry date for WPF Theme DLL

Setting an expiry date for WPF Theme DLL

Scheduled Pinned Locked Moved WPF
csharpwpfhelpquestion
5 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.
  • P Offline
    P Offline
    Prasoon Chaudhary
    wrote on last edited by
    #1

    How can we set an expiry date of dll, if no function of that dll will be called in main application. This question is related to a DLL which is compiled from WPF theme .xaml file. In C#, we will call that .XAML theme from DLL like -

    ResourceDictionary skin = new ResourceDictionary();
    skin.Source = new Uri(@"/Xceed.Wpf.Themes.LiveExplorer.v2.0;component\Xaml/ImplicitStyles.xaml", UriKind.Relative);
    Application app = Application.Current;
    app.Resources.MergedDictionaries.Clear();
    app.Resources.MergedDictionaries.Add(skin);

    And in XAML, we would call that .XAML theme from DLL like -

    Where 'Xceed.Wpf.Themes.LiveExplorer.v2.0' is DLL name, and, 'ImplicitStyles.xaml' is name of XAML theme file. In both ways, I can't see any function being called. But still, application throws an error after 45 days (of first run). Anyone interested can download the dll from Xceed web site, and check the same. So, my question is - how can we create this kind of dll. Please don't provide me links for Trial application/dll maker. Those can check only if some function gets called.

    S 1 Reply Last reply
    0
    • P Prasoon Chaudhary

      How can we set an expiry date of dll, if no function of that dll will be called in main application. This question is related to a DLL which is compiled from WPF theme .xaml file. In C#, we will call that .XAML theme from DLL like -

      ResourceDictionary skin = new ResourceDictionary();
      skin.Source = new Uri(@"/Xceed.Wpf.Themes.LiveExplorer.v2.0;component\Xaml/ImplicitStyles.xaml", UriKind.Relative);
      Application app = Application.Current;
      app.Resources.MergedDictionaries.Clear();
      app.Resources.MergedDictionaries.Add(skin);

      And in XAML, we would call that .XAML theme from DLL like -

      Where 'Xceed.Wpf.Themes.LiveExplorer.v2.0' is DLL name, and, 'ImplicitStyles.xaml' is name of XAML theme file. In both ways, I can't see any function being called. But still, application throws an error after 45 days (of first run). Anyone interested can download the dll from Xceed web site, and check the same. So, my question is - how can we create this kind of dll. Please don't provide me links for Trial application/dll maker. Those can check only if some function gets called.

      S Offline
      S Offline
      SledgeHammer01
      wrote on last edited by
      #2

      Off the top of my head, you would just need a static class in the assembly. Static classes get automatically instantiated when the assembly is loaded.

      P 1 Reply Last reply
      0
      • S SledgeHammer01

        Off the top of my head, you would just need a static class in the assembly. Static classes get automatically instantiated when the assembly is loaded.

        P Offline
        P Offline
        Prasoon Chaudhary
        wrote on last edited by
        #3

        Can that static class stop this c# call-

        skin.Source = new Uri(@"/Xceed.Wpf.Themes.LiveExplorer.v2.0;component\Xaml/ImplicitStyles.xaml", UriKind.Relative);

        or this xaml call -

        Forget about expiry date. Can we set in DLL that if above codes are called from Main/User application - then it should throw an error?

        S 1 Reply Last reply
        0
        • P Prasoon Chaudhary

          Can that static class stop this c# call-

          skin.Source = new Uri(@"/Xceed.Wpf.Themes.LiveExplorer.v2.0;component\Xaml/ImplicitStyles.xaml", UriKind.Relative);

          or this xaml call -

          Forget about expiry date. Can we set in DLL that if above codes are called from Main/User application - then it should throw an error?

          S Offline
          S Offline
          SledgeHammer01
          wrote on last edited by
          #4

          Yes. Static classes are instantiated whenever the DLL is loaded. It is possible to load a DLL as a resource only and never have any code executed, but I don't think thats whats going on here since xaml often references code behind.

          P 1 Reply Last reply
          0
          • S SledgeHammer01

            Yes. Static classes are instantiated whenever the DLL is loaded. It is possible to load a DLL as a resource only and never have any code executed, but I don't think thats whats going on here since xaml often references code behind.

            P Offline
            P Offline
            Prasoon Chaudhary
            wrote on last edited by
            #5

            Your last line of answer

            SledgeHammer01 wrote:

            but I don't think thats whats going on here since xaml often references code behind

            did the trick. As a newbie i couldn't think of that. I referenced a class in Xaml theme and it worked as I wanted... Many thanks!! :)

            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