Outlook Bar and MDI Sheets

Topics: CAB & Smart Client Software Factory
Sep 6, 2006 at 5:44 AM
originally posted by: atmchuck

I'm attempting to combine the Outlook Bar (described in this forum) with an MDI Style interface. I've seen some of the posts here regarding MDI and CAB, and I am getting the sense that a multi-workspace CAB UI and MDI don't easily mix. Outlook itself is not MDI, so maybe that's my first clue...<g>

From what I understand, if I want a "true" MDI-Style interface, then I must have an MDI Client container on a form surface. Is this correct? If so, does the MDI Client container "play nicely" with a multi-workspace CAB?

Another option; should I forget about a "true" MDI-style, and just register my tabs with a menu. I haven't yet tried this, but since I want tabbed sheets anyway, I thought that registering them on a menu might be easier anyway.
Sep 6, 2006 at 6:33 AM
originally posted by: askew

I have not experimented with this type of Workspace, but perhaps you should explore it, the MdiWorkspace in CAB.
The following code is from metadata, showing the MdiWorkspace exists...


using System;
using System.Windows.Forms;

namespace Microsoft.Practices.CompositeUI.WinForms
{
public class MdiWorkspace : WindowWorkspace
{
public MdiWorkspace(Form parentForm);

public Form ParentMdiForm { get; }

protected override void OnShow(Control smartPart, WindowSmartPartInfo smartPartInfo);
}
}
Sep 6, 2006 at 7:45 AM
originally posted by: atmchuck

It appears that the ShellLayoutView I'm using (directly from the SCSF Hands-on-labs) precludes me from using the MDI Container approach, at least, without having to do some major modification.

I was attempting to replace the _rightWorkspace with either a Infragistics.Win.UltraWinTabbedMdi.UltraTabbedMdiManager or a Microsoft.Practices.CompositeUI.WinForms.MdiWorkspace. Both of these are not WinForm controls, so don't nest into my ShellLayoutView.

So, all of this may be obvious to some of you, ;) but I am now understanding now that I need to take apart the ShellLayoutView, pull out the _rightWorkspace, and insert a MdiContainer of some flavor (Microsoft or Infragistics) directly into the ShellForm. I am still thinking through what that means to my menu, since it is embedded in the ShellLayoutView, as well. That will need to come out and stand on it's own, in order to be part of the MDI. Same goes for the ToolBar and StatusBar; I guess the training wheels are coming off now... ;).

Thoughts?
Sep 6, 2006 at 8:53 AM
originally posted by: marianoszklanny

Hi,

If you want to use the Outlook Bar within an MDI interface, you can show the Outlook bar in a child MDI window.

One way to do this could be:

1. Set up the MDI interface, see my first post in this thread:
http://www.gotdotnet.com/codegallery/messageboard/thread.aspx?id=941d2228-3bb5-42fd-8004-c08595821170&mbid=62788f36-a963-4feb-8470-20f1a844ed2a&threadid=c108e856-d95e-4d2b-b7cd-ae21f3d4ff75

2. Create a view 'OutlookBar' in the Shell and add an OutlookBarWorkspace to it. Set the workspace name in the view's constructor:
outlookBarWorkspace1.Name = WorkspaceNames.OutlookWorkspace;

3. In the presenter of the view add the following to code to add the workspace to the root WorkItem:

protected override void OnViewSet()
{
base.OnViewSet();
WorkItem.Workspaces.Add(View.OutlookWorkspace, WorkspaceNames.OutlookWorkspace);
}

4. In the AfterShellCreatedMethod of ShellApplication.cs, show the OutlookBar view in the MDI workspace:

OutlookBar view = RootWorkItem.SmartParts.AddNew<OutlookBar>();
RootWorkItem.WorkspacesWorkspaceNames.MdiWindows.Show(view);

5. You might also want to make the Outlook bar appear in the upper left corner of the Shell and to hide maximize/minimize buttons. Make the OutlookBar view implement the ISmartPartInfoProvider interface and implement the GetSmartPartInfo method:

public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType)
{
WindowSmartPartInfo spInfo = new WindowSmartPartInfo();
spInfo.Location = new System.Drawing.Point(0, 0);
spInfo.MaximizeBox = false;
spInfo.MinimizeBox = false;
return spInfo;
}

6. Show your views as usually in the OutlookBarWorkspace. For instance:

// In ModuleController.cs of a business module
private void AddViews()
{
MyView view = WorkItem.SmartParts.AddNew<MyView>();
OutlookBarSmartPartInfo spInfo = new OutlookBarSmartPartInfo();
spInfo.Title = "My View";
spInfo.EventTopicName = EventTopicNames.ShowView2;
spInfo.Icon = Resources.Icon;
WorkItem.WorkspacesWorkspaceNames.OutlookWorkspace.Show(view, spInfo);
}

7. If you want, subscribe to the event to show another MDI view when the user clicks a button in the OutlookBarWorkspace:

EventSubscription(EventTopicNames.ShowView2, Thread = ThreadOption.UserInterface)
public void ShowMDIView(object sender, EventArgs e)
{
MyView2 view = WorkItem.SmartParts.AddNew<MyView2>();
WorkItem.WorkspacesWorkspaceNames.MdiWindows.Show(view);
}

Hope this helps,

Mariano
http://staff.southworks.net/mariano
Sep 13, 2006 at 2:45 AM
originally posted by: atmchuck

Sorry for the late reply. Thank you for your very thorough answer. It answered my question exactly.