Normal User Control in DNN - dotnetnuke

In DNN, when one is developing a custom module, the user controls for the custom module are normally inherited from a special base class called 'PortalModuleBase' in DNN Framework.
Is it possible to not inherit the custom module user controls from this special DNN base class, but just create a regular user control having its own edit and view logic, that inherits from UseControl .Net Framework base class?

Possible, yes, but then you would lose the benefits of DNN. The PortalModuleBase class inherits from the regular .NET base class, it just provides an added layer with information like TabId (page id), UserInfo (user properties) and other various things that DNN modules regularly use.

Related

Know what changes are made into a database table, using Entity Framework Core

I am using Entity Framework Core for my project, and most of the things are customizable in my project like the public portal UI, and widgets, and these customization changes are reflected back to my database.
Now I want to be notified when a user makes any change to any of the widgets or styling from admin panel and also what changes he made.
Does Entity Framework Core provide such a functionality to track change of data?

How to cleanly implement a startup UI workflow in a Prism WPF app?

I seem to have a chicken-before-the-egg problem in my Prism/WPF app with regards to bootstrapping workflow.
How does one register components in the IoC container, when that registration depends on user options, and those user options need to be collected at startup, which requires a UI workflow, which requires services which are resolved from the container, which requires the container to be already configured?
It seems like a paradox. But ok, I guess I could break up my container registration into two phases, and have a startup procedure like this:
Kick-off PRISM Bootstrapper (e.g. UnityBootstapper) and create the container
Register components required by the startup workflow
Show UI dialog workflow and collect user options/settings
According to the settings just collected, register the remaining application components in the container
Let the CreateShell() and InitializeShell() do their typical thing and resolving the shell window and showing it.
This seems like it should work OK. However, I get the feeling that there has to be a better way. Should the shell (even just a placeholder with a title bar and nice wallpaper image) be shown first, with the startup workflow dialog be shown over top? Of course that implies that there must be a 2nd phase of container registration after the shell is created... which now seems even further from PRISM standards.
Some best-practices in either PRISM or WPF/MVVM in general would be much appreciated.
I'd say this is more a problem of dependency injection than with a particular framework.
Consider this:
you have some UI ViewModel
public class SomeUIVM
{
ctor(IDependency iNeedThis){...}
}
And you need a selection from the user if he wants class DepA : IDependency or class DepB : IDependency.
Rework your setup by having this class registered at startup:
public class SpecificDependencyProvider : IDependencyProvider
{
public IDependency SelectedDependency {get;set;}
}
so then SomeUIVM's constructor takes a IDependencyProvider and accesses the SelectedDependency property. The Selection UI also takes that IDependencyProvider and sets the SelectedDependency.

How can I instantiate the window/view that implements Caliburn Micro's IShell interface inside an Outlook Task Pane

I have a desktop application that is based on the Caliburn Micro framework. Everything works great. Now I am trying to port the same app into Outlook as a plugin.
In the desktop app, based on an entry inside app.xaml, Caliburn knows where to find the bootstrapper and instantiates it.
In case of the Outlook plugin, I've created an overridden bootstrapper that I instantiate explicitly inside ThisAddIn.ThisAddIn_Startup(). This one of course does not use the Application object.
I can even invoke a particular view using code similar to this
var windowManager = IoC.Get<IWindowManager>();
windowManager.ShowDialog(new MyViewModel());
And that will cause the view associated with the view model to be shown in a modal window on top of Outlook (hence validating that Caliburn Micro is able to find a view from a view model inside my Outlook plugin)
What I haven't figured out how to do is instantiate the Shell so that I can start using its functionality.
My expectation was that since my bootstrapper derives from BootStrapper, and I have registered my shell view model implementation with the MEF container as exporting IShell, Caliburn will automatically instantiate the shell view model and start using it. That is not happening.
My goal is to get the shell loaded inside my plugin's task pane as the container for other views that I will be loading based on user actions.
Any ideas or tips on how I can get this to work? In general has anyone got a shell implementation loading inside an Outlook or Office plugin's task pane?
Thanks!
Do you mean instantiate via Bootstrapper<Shell>. This uses the Window Manager underneath but I don't think that extends to outlook. There is nothing stopping you using the same code above to initialize your shell manually, composition will handle the rest of the application.
IoC.Get, by default calls Activator.CreateInstance so it is possible your problem is with MEF. The method that drives opening the Shell DisplayRootViewFor() calls this line.
windowManager.ShowWindow(IoC.GetInstance(viewModelType, null), null, settings);
If MEF is not hooked up properly it will fail causing your shell not to load.

How can I instantiate a page class in windows phone like in desktop Silverlight?

Windows phone template creates MainPage class but I can't see where it instantiates it anywhere in source code ?
So how does it work internally ?
Update: In Silverlight, Instantiation can be done in application startup, what would be the equivalent in Windows Phone ?
The only place I could find it was within the WMAppManifest.xml file. I would assume that the OS uses that to navigate to the MainPage when the app is launched.
<Tasks>
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
</Tasks>
The PhoneApplicationPage is a control. Yes, when you navigate to the page, object for the Page is internally created. You can, of course, refer to them in their namespaces, as with any other control. Like with any other framework, some things are taken care of, by the framework.

How to access web application class into silverlight application

I am beginner in silverlight..I have created a silverlight project. When a new silverlight project is created it is automatically creating a silverlight application and one web application. I have added a class in both applications. Now I want to access a method of web application class into silverlight application class. Is it possible? I have tried to add web application reference to silverlight but VS is not allowing. Is there any another way to do??
What you need is called WCF. A really simple tutorial that should get you going is found here: How to call WCF methods from Silverlight controls
Fundementally WCF allows the silverlight client to make method calls on a class instance hosted on the web site.
Yes it is possible, but not in the normal way. A Silverlight assembly can only reference another Silverlight assembly (this is a limitation of VS2008, i don't know if it has been changed in VS2010).
What you need to do is add an existing file to your Silverlight project, when the file browse dialog opens you navigate to the class file you want to reuse, but instead of just clicking the Add button, click on the little down arrow on the button and choose Add as link - now the file will "exist" in both projects and can be used in both.
If you are going to do this repeatedly though, you will want to move those shared class files out into a separate assembly, do a project reference from your web app, and have the equivalent Silverlight class library mirroring it (sharing the files as links), and then project reference that Silverlight class library from your Silverlight app.

Resources