Wrong EditorFactory Being Called

Discussions related to SoftPro Select user interface development.

Moderator: Phil Barton

roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Wrong EditorFactory Being Called

Post by roteague »

I've got a package, with multiple buttons. The correct button code is being called, but the wrong editor factory gets instantiated, causing the wrong screen to be loaded.

The package is defined as follows (some lines left out for clarity):

Code: Select all

[ProvideEditorFactory(typeof(DuplicateTMKEditorFactory), "Duplicate TMK Editor Factory")]
    [ProvideEditorExtension(typeof(DuplicateTMKEditorFactory), "sp-select", "TGAdminScreensPackage/DuplicateTMK", 10)]
    [ProvideEditorFactory(typeof(PrintJobTasksEditorFactory), "PrintJobTasks Editor Factory")]
    [ProvideEditorExtension(typeof(PrintJobTasksEditorFactory), "sp-select", "TGAdminScreensPackage/PrintJobTasks", 15)]
    [Guid(TGAdminScreensPackage.PackageGuidString)]
    partial class TGAdminScreensPackage : Package
    {
        protected override void OnInitialize()
        {
                base.RegisterHandler(TGAdminScreensPackage.TGAdminRibbonTab, null, this.TGAdminRibbonTab_QueryStatus);

                // Setup event handlers for screen buttons
                base.RegisterHandler(TGAdminScreensPackage.DuplicateTMKAdminButton, this.DuplicateTMKAdminButton_Invoked);
                base.RegisterHandler(TGAdminScreensPackage.PrintJobTasksRibbonButton, this.PrintJobTasksButton_Invoked);

                // Register our editor factory.
                base.RegisterEditorFactory(new DuplicateTMKEditorFactory(this));
                base.RegisterEditorFactory(new PrintJobTasksEditorFactory(this));
        }
        private void DuplicateTMKAdminButton_Invoked(object sender, EventArgs e)
        {
                Uri moniker = new Uri(@"sp-select:///TGAdminScreensPackage/DuplicateTMK");

                IShell shell = GetService<IShell>();
                shell.OpenStandardEditor(moniker);
        }

        private void PrintJobTasksButton_Invoked(object sender, EventArgs e)
        {
                Uri moniker = new Uri(@"sp-select:///TGAdminScreensPackage/PrintJobTasks");

                IShell shell = GetService<IShell>();
                shell.OpenStandardEditor(moniker);
        }
Any ideas what is missing here?

Thanks,
Robert
Hadi Chemaly

Re: Wrong EditorFactory Being Called

Post by Hadi Chemaly »

The package attributes and initialize method seem to be defined correctly. I suspect you may have the same guid defined for two factory types, causing the shell to pick the wrong one. Can you verify?
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Wrong EditorFactory Being Called

Post by roteague »

No, the Guid's are different:

Code: Select all

internal const string DuplicateTMKEditorFactoryGuidString = "09ADFB7D-09E6-4608-9D4C-34641D434FB2";
internal const string PrintJobTasksFactoryGuidString = "FA27E977-1825-49C1-8F9B-002D3DF5025A";
Robert
Hadi Chemaly

Re: Wrong EditorFactory Being Called

Post by Hadi Chemaly »

Let's inspect the registry to find out if this is a package registration problem.

In the registry under your Select experimental hive (example: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SoftPro\Select\2.6Exp), ensure both your factories are listed under the Editors key, and inspect their Extensions entry. If you find an inconsistency, unregister and re-register your package and try running again.

Let me know what you find.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Wrong EditorFactory Being Called

Post by roteague »

Sorry to take so long to get back to this, other higher priority projects came up.

I've double checked the registry, and both are consistent with the GUIDs I provided.
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Wrong EditorFactory Being Called

Post by roteague »

One interesting item. When I click both buttons I get two "Duplicate TMK Managemet" tabs, and re-clicking the button hightlights the corresponding tab. I should only expect one tab, since only one editor factory is being called. All the GUIDs are correct.
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Wrong EditorFactory Being Called

Post by roteague »

Also, I need to point out this is a VisualStudio 2010 project, so I'm having to hand edit the code behind file for the .ctd file.
Robert
Hadi Chemaly

Re: Wrong EditorFactory Being Called

Post by Hadi Chemaly »

Robert,

Using VS 2010 ton construct a Select package is not officially supported by SoftPro at this point, hence I cannot say for sure what the problem is. We have not tested that scenario inhouse. What I recommend for you is to create a barebones project similar to this in VS 2008, with the same .ctd file and the two editor factories, and verify that it works against Select.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Wrong EditorFactory Being Called

Post by roteague »

Thanks Hadi, I may do that. However, ALL our development in is done in VS2010, moving a project back to VS2008 makes it difficult for us to keep proper control of our source code.

SoftPro really needs to get on the ball and officially support VS2010; there is no reason why your company continues to only support a product that is out of date.
Robert
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Wrong EditorFactory Being Called

Post by roteague »

Ok, I built a brand new Package in VS2008. The package exhibits the same problem as before. Both buttons call the same editor factory. Would you like me to send you the pacakage so you can look at it?
Robert
Post Reply