Setting an expiry date for WPF Theme DLL
-
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.
-
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.
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.
-
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.
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?
-
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?
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.
-
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.
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!! :)