0
votes

Ok, time is coming for my first WPF project :). I work before with Flex and PureMVC and I know how project setup is important in RIA's. I decided to work with MVVM. And decided to work with PRISM framework. Application is somethin like operating system. There will be 'shell' (parent for smaller applications). Smaller application I plan to make like modules. So I plan to design structure of project something like this.

Module_A {view, viewModel, model, assets} // for example calculator Module_B {view, viewModel, model, assets} // notebook

etc I read prism doc and I see that parrent for all this modules should be shell project, and this is my main question here.

Parrent_Project {App.xaml, Bootstrapper.cs, Shell.xaml}

Because this shell will be fullscreen with background images (like operating system), right click with some features. Is that ok to create folder structure like in modulesXYZ for Shell.xaml here? I want to start project with good structure so any advice is welcome. Thanks

Maybe I was not clear. Can I use Shell to add it some functionality (in MVVM manner) like set it to fullscreen, always on top etc. Or not?

I want to shell be in full kiosk mode. And I did somethong about it with folowing code. But when I press alt + tab, win key or other taskbar goes ove my app. Is there any solution for this:

public class Interop
    {
        [DllImport("user32.dll")]
        public static extern bool SetForegroundWindow(IntPtr hWnd);

        [DllImport("user32.dll")]
        public static extern IntPtr GetForegroundWindow();

        public static IntPtr GetWindowHandle(Window window)
        {
            return new WindowInteropHelper(window).Handle;
        }
    }

public Shell()
        {            
            InitializeComponent();



            IntPtr window = Interop.GetWindowHandle(this);
            IntPtr focused = Interop.GetForegroundWindow();
            if (window != focused)
            {
                Interop.SetForegroundWindow(window);
            }

        }
1

1 Answers

1
votes

The simplest way to achieve the effects you desire is by configuring the shell. Specifically, setting the following values in Shell.xaml will nominally provide the desired result:

<Window ... WindowStyle="None" WindowState="Maximized" Topmost="True>

and if these properties don't need to change then this approach is already MVVM friendly as it is purely a view issue.