Usman ur Rehman Ahmed's blog

DNM Rad Footer section not displayed for view form

Assuming your main content lies wihtin the Body section of a view form, If you will not check the property "Multiple Rows" the footer section will be displayed as following,

Edit_button
To fix this, simply go to view form properties and check "Multiple Rows" so that body is parsed properly and footer section is displayed.

Multiple_rows

The desired peroper will now be rendered with footer section properly,

Add-button-dnm-rad

Archive for

January 2012

Windows Phone 7 ResolveHostNameAsync

The class DeviceNetworkInformation packaged within namespace Microsoft.Phone.Net.NetworkInformation provides two overloaded methods to resolve hostname asynchronously.

The overloads differ such that former allows you to specify the network interface using which hostname needs be resolved where as earlier will use the first avialable network interface in the list (If both WiFi and Ethernet are available then my understanding is that Ethernet will take precedence)

Here is a simple app demonstrating how to retrieve IPs against hostname.

Resolve-hostname
Note: Since call to method (ResolveHostNameAsync) is asynchronous in nature, the foreground thread won’t let you interact with the UI interface in the callback method  nameResolutionCallback(NameResolutionResult result). That's why you will see that interaction with UI is managed by call to dispatcher. However a more sophisticated approach will be to execute this call on the background thread.

Code behind

        private void btnResolveHostName_Click(object sender, RoutedEventArgs e)
        {
            if(!string.IsNullOrEmpty(txtHostName.Text))
            {
                DnsEndPoint endPoint = new DnsEndPoint(txtHostName.Text, 80);
                Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.ResolveHostNameAsync(endPoint, nameResolutionCallback, new object());
            }
        }

        public void nameResolutionCallback(NameResolutionResult result)
        {
            if (result.NetworkErrorCode == NetworkError.Success)
            {
                List<string> items = new List<string>();
                items.Add(string.Format("Network Interface Type : {0}", result.NetworkInterface.InterfaceType));

                foreach (IPEndPoint ipEndPoint in result.IPEndPoints)
                {
                    items.Add(string.Format("Resvoeld IP : {0}:{1}", ipEndPoint.Address.ToString(), ipEndPoint.Port.ToString()));
                }

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    lstInfo.ItemsSource = items;
                    txtHostName.Focus();
                });
            }
            else
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show(result.NetworkErrorCode.ToString(), "Error", MessageBoxButton.OK);
                    txtHostName.Focus();
                });
            }
        }

XAML

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="Resolve Hostname" Style="{StaticResource PhoneTextNormalStyle}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <TextBox Name="txtHostName" Width="300" Margin="6,-5,150,623" Text="google.com"></TextBox>
            <Button Name="btnResolveHostName" Margin="300,-5,-5,623" Click="btnResolveHostName_Click">Resolve</Button>
            <ListBox Name="lstInfo" Margin="12,79,6,39" BorderThickness="1" BorderBrush="Azure"></ListBox>
        </Grid>
        </Grid>

 

Archive for

January 2012

11
To Posterous, Love Metalab