app bar in windows phone 8 - windows-phone-8

Greetings.
I was trying to add an app bar to the windows phone 8(VS 2013 & framework 4.5) application.
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" Opacity="1.0" >
<shell:ApplicationBarIconButton IconUri="/Images/save.png" Text="save" Click="Button1_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/delete.png" Text="delete" Click="Button2_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/help.png" Text="help" Click="Button3_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/settings.png" Text="settings" Click="Button4_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="get default size value" Click="MenuItem1_Click" />
<shell:ApplicationBarMenuItem Text="get mini size value" Click="MenuItem2_Click" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
The app bar buttons are getting displayed in this specific page, but in other pages it is not visible. How we can make the app bar and its button visible global?
Thanking you in advance
Sebastian

you needed To create a global Application Bar that can be reused on multiple pages. Usually we create an Application Bar on the page we want to use it on, and it applies only to that page. For this purposes here is a good example create a global Application Bar , you needed to create a global Application Bar by using XAML in App.xaml as shown in example.
or
You need to write same AppBar code in all individual pages for displaying it to all pages as you Described in Question

You can also create it programmatically and store a reference to it in your App.xaml.cs, and insert it in every page, in constructor, like this:
this.ApplicationBar = App.GlobalAppBar;
Creation is simple as:
ApplicationBarIconButton firstButton = new ApplicationBarIconButton();
firstButton.IconUri = new Uri("/Images/save.png", UriKind.Relative);
firstButton.Click += Button1_Click;
firstButton.Text = "save";
GlobalAppBar = new ApplicationBar();
GlobalAppBar.Buttons.Add(firstButton);

Related

Navigate from Struts1 page to a Struts 2 page

We are slowly migrating our application from Struts1 to Struts 2, but for the first iteration we are simply having them run together and all new pages will be in Struts2. My problem is: how do I navigate from a strut1 page to a struts2 page?
I have a struts1 page that allows the user to select a report type. All but one selection is struts1. The last selection is a struts2 page. I need to get from the selection screen (struts1) to the new struts2 page.
Here is some code:
struts-config.xml
<action path="/reporting" type="........ReportingAction" name="reportForm" input="/WEB-INF/jsps/reporting.jsp" scope="session">
<forward name="outbound" path="/WEB-INF/jsps/reportingSelectDate.jsp">
</forward>
<forward name="inbound" path="/WEB-INF/jsps/reportingInboundSelectDate.jsp">
</forward>
<forward name="usage" path="/WEB-INF/jsps/reportingUsageSelectDate.jsp">
</forward>
<forward name="expansion" path="/s2/expansionReportEntry.jsp">
</forward>
<forward name="failure" path="/WEB-INF/jsps/reporting.jsp">
</forward>
<forward name="login" path="/login.do">
</forward>
</action>
I want to forward "expansion" to the new Struts 2 page. Is this the correct way to go about it? Assuming I have struts.xml and web.xml set up correctly. I have struts2 filter handling .action and struts1 doing .do.
The right way is to redirect to the new framework, even if maintaining two frameworks is not recommended
<forward name="expansion" path="/s2/expansionReportEntry.action" redirect="true">

How to display a new page within an existing main page in primefaces?

i was trying to display a web page within a page in primefaces. There exists a menu, and when the user clicks on a particular menu item i want the content to be displayed within the same page ie within the body of the main page. How can i achieve that?
Earlier i was opening the page in a new tab , il post the sample code here:
<p:submenu label="Tools">
<p:menuitem
onclick="window.open('https://newpage/login.do')"
value="New page"></p:menuitem>
You could use ui:include (xmlns:ui="http://xmlns.jcp.org/jsf/facelets") to include arbitrary pages which are even dynamically calculable:
<ui:include src="#{bean.page}"/>

Win Phone 8 WP8 Creating Dynamic Controls at runtime

I need to be able to create dynamic controls at runtime - textblocks, buttons to be specific. I have tried this:
dim b as button = new button
b.content="test"
The code does not error but also does not produce a button either. Simple I know but for Wp8 it's quite difficult for me.
Thanks
You still need to add the button to your page. Try this:
Xaml
<ContentControl x:Name="container">
</ContentControl>
Code
Dim b as New Button With { .Content = "test"}
container.Content = b

Flex 4.6 SplitViewNavigator - Display / Hide Navigators

I have just started a new project and am looking to use the SplitViewNavigator layout for some of my screens as it lends itself well to what I'll be doing.
However not all of the screens should use this layout (homeview being one of them). So I started by setting the visibility of the side view as false.
<s:SplitViewNavigator includeIn="tablet" width="100%" height="100%">
<s:layout.landscape>
<s:HorizontalLayout />
</s:layout.landscape>
<s:layout.portrait>
<s:VerticalLayout />
</s:layout.portrait>
<s:ViewNavigator width.landscape="35%" height.landscape="100%"
width.portrait="100%" height.portrait="30%"
firstView="views.TestView" visible="false"/>
<s:ViewNavigator width="100%" height="100%" height.portrait="100%"
firstView="views.OnSiteFormHomeView" />
</s:SplitViewNavigator>
I know how to access the SpitViewNavigator and the individual ViewNavigators. So I did the following in my home view (as a test) but nothing seems to happen. (the other navigator stays full screen). I've tried attaching the code to the intialize and creationcomplete events.
// Create a reference to the SplitViewNavigator.
var splitNavigator:SplitViewNavigator = navigator.parentNavigator as SplitViewNavigator;
// Create a reference to the ViewNavigator for the Detail frame.
var sideNavigator:ViewNavigator = splitNavigator.getViewNavigatorAt(0) as ViewNavigator;
var detailNavigator:ViewNavigator = splitNavigator.getViewNavigatorAt(1) as ViewNavigator;
sideNavigator.visible = true;
I assume that I need to somehow make it redraw the screen/navigators. I've tried calling the initialize function on the splitviewnavigator and also the individual navigators but it seems to make no difference.
To answer my own query. I found that it works for me between views (popping/pushing) so I can just do the following (from a single view screen):
sideNavigator.visible = true;
sideNavigator.pushView(SideViewHere);
detailNavigator.pushView(NewMainView);
and the reverse would be:
detailNavigator.popView();
sideNavigator.visible = false;
sideNavigator.popView();
Which gives me everything I need.

Disable System Ribbon in CRM 2011

I would like to conditionally disable a System Ribbon = AddNew in a CRM 2011 form with javascript. That means if the statusCode is X or Y disable the Ribbon, how could I do this?
I tryed to get the ID of the Ribbon in order to change the classname of the Ribbon to disabled, but I got Null because the Ribbons are loaded asychronously!
To expand on Anwar's answer, the key to getting this to work is to intercept and repurpose the functionality of the AddNew ribbon button, but once you do, there won't be any need for hacking the Ribbon DOM. Below are a few steps that you can take to get there.
1) Create a solution with the Application Ribbon included.
2) Find in the SDK the sample ribbon for the Application Ribbon or build it yourself using the solution included in the SDK.
\sdk\resources\exportedribbonxml
\sdk\samplecode\cs\client\ribbon\exportribbonxml\exportedribbonxml
3) Find in the Application Ribbon template the control you're interested in, which I assume in this case is the AddNew button in entity subgrids. Repurpose this control in a CustomAction and make the location of the CustomAction the same name as the control you want to repurpose.
<CustomAction Id="YourOrg.SubGrid.{!EntityLogicalName}.AddNewStandard"
Location="Mscrm.SubGrid.{!EntityLogicalName}.AddNewStandard">
<CommandUIDefinition>
<Button Id="Mscrm.SubGrid.{!EntityLogicalName}.AddNewStandard"
Command="Mscrm.AddNewRecordFromSubGridStandard" Sequence="20"
LabelText="$Resources(EntityDisplayName):Ribbon.SubGrid.AddNew"
Alt="$Resources(EntityDisplayName):Ribbon.SubGrid.AddNew"
Image16by16="/_imgs/ribbon/NewRecord_16.png"
Image32by32="/_imgs/ribbon/newrecord32.png" TemplateAlias="o1"
ToolTipTitle="$Resources(EntityDisplayName):Mscrm_SubGrid_EntityLogicalName_MainTab_Management_AddNewStandard_ToolTipTitle"
ToolTipDescription="$Resources(EntityDisplayName):Mscrm_SubGrid_EntityLogicalName_MainTab_Management_AddNewStandard_ToolTipDescription" />
</CommandUIDefinition>
</CustomAction>
4) Find in the Application Ribbon template the definition of the command of this button, and using the exact definition as the basis of a new CommandDefinition, add in your own custom rule (in this case, a new EnableRule).
<CommandDefinition Id="Mscrm.AddNewRecordFromSubGridStandard">
<EnableRules>
<EnableRule Id="Mscrm.AppendToPrimary" />
<EnableRule Id="Mscrm.EntityFormIsEnabled" />
<EnableRule Id="YourOrg.DisableNewStuff" /> <!--your custom rule-->
</EnableRules>
<DisplayRules>
<DisplayRule Id="Mscrm.ShowForOneToManyGrids" />
<DisplayRule Id="Mscrm.AppendToPrimary" />
<DisplayRule Id="Mscrm.CreateSelectedEntityPermission" />
<DisplayRule Id="Mscrm.AppendSelected" />
<DisplayRule Id="Mscrm.HideAddNewForChildEntities" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="Mscrm.GridRibbonActions.addNewFromSubGridStandard"
Library="/_static/_common/scripts/RibbonActions.js">
<CrmParameter Value="SelectedEntityTypeCode" />
<CrmParameter Value="PrimaryEntityTypeCode" />
<CrmParameter Value="FirstPrimaryItemId" />
<CrmParameter Value="PrimaryControl" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
5) Here is where Anwar's answer comes in: using both the OrRule and the ValueRule, define your EnableRule to check on the statuscodes of the entity. The linked demonstration relates to a new ribbon button, but the same rules work for repurposed ribbon controls as well.
Publish your changes when you're done and your ribbon should be all set. Because I'm not sure how familiar you are with RibbonXml, I'll also mention that Microsoft has some comprehensive walkthroughs that are pretty helpful (after much time studying them!) in picking it up.
This article explains exactly what your are looking for.
Please follow this link
How To Use "ValueRule" and "OrRule" in Ribbon Customizations - CRM 2011
This is how i hide the delete button on invoice form, based on status code, onload of the form:
var statusVal = Xrm.Page.getAttribute("statuscode").getValue();
if (statusVal==4 || statusVal==6) {
//Disable delete button
var x =top.document.getElementById("invoice|NoRelationship|Form|Mscrm.Form.invoice.Delete-Medium");
x.style.display='none';
You can get the id of the element span, which you want to hide from the source of the page.