This project is read-only.

How to : File menu caption Change

Jan 17, 2014 at 6:50 AM
Hi,

First of all, almost one week ago, we have just started using CODE framework and absolutely it is perfect, easy to learn, easy to implement etc.

Now I can do many but one thing is I could not manage, changing the FILE menu caption!
I can create ViewCategory than change it via Caption property but Shell changing it is order by making it second menu, I have tried Order property for both first and second menus but all failed,
What I want, FILE should be change to 'Dosya' and it must be always the first menu.

Many Thanks in advance,
Best regards.
Jan 17, 2014 at 1:51 PM
Hello emrahyildirim,
I'm not sure I follow exactly where you are at, but when adding items to the Actions collection the first parameter of the ViewAction is a string which will be utilized when displaying the action. For example when looking at the following line of code:
Actions.Add(new ViewAction("Menu Item #3", execute: (a, o) => Controller.Message("You clicked Menu Item #3!")));
The string "Menu Item #3" is what will be shown on when displaying the link, button, or whatever control represents that action. If this is not what you are after, then look at the categoryCaption or groupTitle options.

With respect to the order, ViewActions appear on the screen in the order they are added to the Actions collection. So the following code:
Actions.Add(new ViewAction("Menu Item #1", execute: (a, o) => Controller.Message("Menu Item #1 clicked!")));
Actions.Add(new ViewAction("Menu Item #2", execute: (a, o) => Controller.Message("Menu Item #2 clicked!")));
Actions.Add(new ViewAction("Menu Item #3", execute: (a, o) => Controller.Message("Menu Item #3 clicked!")));
will result in three items show, with #1 first. The other possibility to look at here is the categoryOrder option.

Hope this helps,
Jeff
Jan 18, 2014 at 6:54 AM
Edited Jan 18, 2014 at 6:59 AM
Hi TexasJetter,
I think I couldn't explain what I want exactly, no problem for actions or creation order of sub menu items but the problem is changing the first main menu caption;
please look at attached picture, Image(CaptionImage1), the main menu have 3 - menus:
FILE,'Abone İşlemleri' and 'Görünümler'
Here I want to change the 'File' caption with 'Dosya' and when I used following code the second main menu 'Abone İşlemleri' becomes the first menu in the list (Image)(CaptionImage2) which is I dont want, however the order should be Dosya, 'Abone İşlemleri' and 'Görünümler' like that.

I hope I have cleared confusion about my problem

thank you in advance

best regards.

In StartViewModel.cs :
...
    var close = new ApplicationShutdownViewAction("ÇIKIŞ", true);
            ViewActionCategory vac = new ViewActionCategory("dosya", "Dosya");
            vac.IsLocalCategory = true;
            vac.AccessKey = '0';
            close.Categories.Add(vac);
            close.GroupTitle = "Dosya";

            var customerAction = new ViewAction("Abone Listesi",
    execute: (a, o) => Controller.Action("Customer", "List"),
    category: "Abone İşlemleri", categoryAccessKey: 'A', accessKey: 'L', beginGroup: true, brushResourceKey: "CODE.Framework-Icon-List");
            var customerActionAdd = new ViewAction("Abone Ekle",
                execute: (a, o) => Controller.Action("Customer", "Add"),
                category: "Abone İşlemleri", categoryAccessKey: 'A', accessKey: 'L', beginGroup: true, brushResourceKey: "CODE.Framework-Icon-Add");
            customerAction.Significance = ViewActionSignificance.Normal;
            customerActionAdd.Significance = ViewActionSignificance.Normal;
           
            Actions.Add(close);
            Actions.Add(customerAction);
            Actions.Add(customerActionAdd);
        
Jan 18, 2014 at 9:59 PM
Ok I see what you are trying to do now. I will have to dig further, but it appears that the ApplicationShutdownViewAction does not currently support the category option. As an alternative I would suggest adding a normal ViewAction and pointing to a controller method that calls ApplicationEx.Current.Shutdown();

I've polled a couple of people to see if they have any other suggestions.

Jeff
Jan 19, 2014 at 11:20 AM
Edited Jan 19, 2014 at 11:29 AM
I just took a close look at this. Fundamentally, the idea would be to set the category's order like this:
var quit = new ApplicationShutdownViewAction("Quit", true);
quit.Categories.Add(new ViewActionCategory("Dosya") {Order = 0});
Actions.Add(quit);
However, there seems to a bug in the Workplace theme that appears to ignore the order property on the categories. I am looking at this now to have it fixed in the next build (which isn't too far off).


Markus