|
Hi Friends
i have created a loader user control in wpf now i want to show loader when calling Webservice and after i get responce i should collapse the Loader control. but it not working what should i do.
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
wasimsharp wrote: but it not working what should i do.
What's not working?
Make sure your web service is called asynchronously so the UI thread
can show the control. That's just a guess based on the complete lack of
information in your post.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am attemptimg to programmatically highlight a selection of text in a textbox.
I trying to achieve this by so doing:
tbxItemUrl.SelectionStart = 0;
tbxItemUrl.SelectionLength = pageDetailItemSection.tbxItemUrl.Text.Length;
tbxItemUrl.SelectionBackground = new SolidColorBrush(Colors.Yellow);
tbxItemUrl.SelectionForeground= new SolidColorBrush(Colors.Black);
but to no avail.
some resources...i have attempted to try
[][^]
Has anybody successfully managed to do this...thanks
|
|
|
|
|
I did not have to search far[^]. Hope it helps !
There are only 10 types of people in this world — those who understand binary, and those who don't. |
modified on Friday, January 8, 2010 1:02 PM
|
|
|
|
|
Also, your code probably didn't work because the TextBox didn't have focus.
This worked for me:
System.Windows.Browser.HtmlPage.Plugin.Focus();
tbxItemUrl.SelectionStart = 0;
tbxItemUrl.SelectionLength = tbxItemUrl.Text.Length;
tbxItemUrl.SelectionBackground = new SolidColorBrush(Colors.Yellow);
tbxItemUrl.SelectionForeground = new SolidColorBrush(Colors.Black);
tbxItemUrl.Focus();
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the replies.
Really appreciated.
The focus definitely works, thank you, however i have multiple textboxes that i am looking for matches in and would like to highlight any matches in all the necessary textboxes.
Setting the focus would only then highlight 1 textbox.
Any suggestions would be welcome.
Thanks again.
|
|
|
|
|
You'll need to do highlighting something like
Abhinav S linked to above.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Check this: http://forums.silverlight.net/forums/p/137089/306336.aspx
modified 27-May-14 4:58am.
|
|
|
|
|
Hi,
Is there any way to find out gradient colors and stops from image?
I have mockups of screen from my user experience guy. From those i want to find out gradient stops (points) and colors he used. currently I am using Paint.net and expressing blend and getting the colors creating them in XAML for the same. GradientStops are the biggest challenge.
Thanks
|
|
|
|
|
I don't think there is any tool to infer gradient information from an image. This seems like it could get rather complicated. What you might be able to do is create a differential image. You can create an image where each pixel represents the maximum difference in color between that pixel and the pixels neighboring it in the source image. That way, you can have a visualization of the changes in color, rather than just a visual of the colors. That should help you identify exactly where changes to changes (i.e., gradient stops) occur in the image. You could go a step further and make another image that is a differential image of the differential image. This will allow you to see changes in changes in changes (that may be useful for visualizing polynomial gradients that change into different polynomial gradients).
But you'd have to build that tool yourself (unless anybody knows of a tool that can do that). I'd say just eyeball it or have your user experience guy use Expression Blend so you can see the actual XAML that creates the image.
|
|
|
|
|
Thanks. Yes, using expression blend by user experience was one of the options we explored, but he is not that familiar with it and he is the only one in team and using EB is time consuming.
|
|
|
|
|
What tool is he using to mockup the screens? If he's using something like Photoshop, there is a XAML converter available - take a look here[^] for details.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks for the suggestion and yes he is using Photoshop. I will try using the tool you pointed to.
|
|
|
|
|
Hi there, I am getting an error in K2 Service Manager.
System.Exception: Datafield LINE MANAGERApprovals not found
at SourceCode.KO.DataFields.get_Item(String Index)
at SourceCode.KO.DataFields.get_Item(String Index)
at GenFunctions.GetSettings(ServerEventContext K2, Int32 FormTypeId)
at K2Code193479.Main(ServerEventContext K2)
Can you please tell me how to resolve this problem?
Thanks in advance,
Jhon.
|
|
|
|
|
Well, I would suggest that you might get a better answer on this site[^] which is dedicated to the software.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i have constructed a 3D object using WPF and i want to rotate that object. i also use the following code to rotate the object:
<Transform3DGroup>
<RotateTransform3D x:Name="rotate_center_x" CenterX="1" CenterY="0" CenterZ="0">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="rotatex" Axis="1,0,0" Angle="0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D x:Name="rotate_center_y" CenterX="0" CenterY="1" CenterZ="0">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="rotatey" Axis="0,1,0" Angle="0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<RotateTransform3D x:Name="rotate_center_z" CenterX="0" CenterY="0" CenterZ="1">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="rotatez" Axis="0,0,1" Angle="0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
but the problem is, when i rotate the object for a certain angle in x, y and z axis, and come to x-axis again, it doesn't rotate the same direction as previous. you can see the similar types of scenario in the following link.
Click Here
may be here the object rotate along its local coordinate, not its world coordinate. how can i solve this problem?
|
|
|
|
|
Alright, here's what I've got. I have an IEnumerable collection of type <Person> containing some random info (name, age, etc). I create a PagedCollectionView using my <Person> collection and bind it to a DataGrid. Then I make a PropertyGroupDescription using the "Name" property of my <Person> object and voila, I've got a datagrid that is grouped by name.
////code for above///////////////
PagedCollectionView pagedCollectionView = new PagedCollectionView(Person.GetPeople(), true, false);
PersonDataGrid.ItemsSource = pagedCollectionView;
PropertyGroupDescription namePropertyGroupDescription = new PropertyGroupDescription("Name");
pagedCollectionView.GroupDescriptions.Add(namePropertyGroupDescription);
/////////////////////////////////
Now instead of just showing the name of the group and the number of items in the RowGroupHeader, I would like to show a DataGrid containing the 1st row of each group. Using this code:
<Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Center">
<data:DataGrid x:Name="PersonDataGrid" AutoGenerateColumns="False">
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
<data:DataGridTextColumn Header="Age" Binding="{Binding Age}" />
<data:DataGridTextColumn Header="Height" Binding="{Binding Height}" />
<data:DataGridTextColumn Header="Weight" Binding="{Binding Weight}" />
<data:DataGridTextColumn Header="Phone Number" Binding="{Binding Phone}" />
</data:DataGrid.Columns>
<data:DataGrid.RowGroupHeaderStyles>
<Style x:Name="DataGridRowGroupHeaderStyle" TargetType="data:DataGridRowGroupHeader">
<Setter Property="SublevelIndent" Value="0" />
<Setter Property="Height" Value="80" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<data:DataGrid AutoGenerateColumns="False" HeadersVisibility="None" ItemsSource="{Binding Items}">
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Name" Binding="{Binding Name}" />
<data:DataGridTextColumn Header="Age" Binding="{Binding Age}" />
<data:DataGridTextColumn Header="Height" Binding="{Binding Height}" />
<data:DataGridTextColumn Header="Weight" Binding="{Binding Weight}" />
<data:DataGridTextColumn Header="Phone Number" Binding="{Binding Phone}" />
</data:DataGrid.Columns>
</data:DataGrid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</data:DataGrid.RowGroupHeaderStyles>
</data:DataGrid>
</Grid>
I've got all of the items in the group showing up in the grid contained in the RowGroupHeader. Is there any way to just show the first row of each group in my RowGroupHeader? I've tried using a converter:
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
List<Person> personList = (value as IEnumerable<Person>).ToList();
return new List<Person> { personList[0] };
}
but I can't get it to work properly. Any ideas?
|
|
|
|
|
C.J. wrote: <data:datagrid autogeneratecolumns="False" headersvisibility="None" itemssource="{Binding Items}">
Any luck with ItemsSource ="{Binding Items[0]} ?
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Nope. I've been secretly hoping that it would be something easy like that, but alas. When I use Items[0] I get an empty grid.
|
|
|
|
|
I'm sorry - one more try (with the group)
data:DataGridTextColumn Header="Name" Binding="{Binding Name[0]}"
or
data:DataGridTextColumn Header="Name" Binding="{Binding Person[0].Name}"
In one scenario, I was able bind to a collection use something like myCollection[0].myProperty.
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Cool. Thanks for your replies. I ended up using a converter, and the problem with my old converter was that I didn't include
<Grid.Resources>
<Common:GroupHeaderBinder x:Key="GroupHeaderBinder" />
</Grid.Resources>
in my code.
|
|
|
|
|
Hi all,
I have two questions about styling a datagrid.
1. I have a style for the combobox. Is it possible to apply the same style to my datagridcomboboxcolumn? Right now my datagridcomboboxcolumn looks like the default windows combobox.
2. How do I set the background of all column headers? I tried a lot, but if I resize my last column (on the right side) to the right and then back to the left, a standard grey header background is displayed at the right side of my last column. This grey header background does not belong to any column. It seems like there is a something like a column container which includes all columns.
Any help is apprechiated.
reibor.
|
|
|
|
|
1) Something like this perhaps?
<wpftk:DataGridComboBoxColumn EditingElementStyle="{StaticResource MyComboBoxstyle}" />
(or try ElementStyle=...)
2) Try setting the Width property on the last column to "*".
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a Silverlight 3.0 application which has the following:
listbox listbox grid (editContainer)
Customers Locations 3 comboboxes
2 textboxes
2 buttons
At startup the customer listbox is populated -- nothing else! At this point all of the controls in the editContainer are unaccessible...as if they are in a disabled state.
When a customer is selected the customer Locations list is populated, 2 comboboxes are populated. I've walked through this in debug mode and confirmed that the comboboxes are indeed getting data. The combo boxes are using code from another site that inherits the base silverlight code and adds the population logic when a database item has the key value instead of the text value in the combo box.
When I get the message that I can now edit data, everything in the editContainer is still in a disabled state. ComboBoxes don't drop down, cannot get my cursor entered into the textbox, and my buttons don't fire events. I initially thought it was because I added code to set the selected index on the combo boxes to -1, but even after commenting all that out I still have read-only controls.
here is the xaml:
<navigation:Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
xmlns:DatabaseManager_Silverlight_MasterService="clr-namespace:DatabaseManager.Silverlight.MasterService"
xmlns:DatabaseManager_Silverlight="clr-namespace:DatabaseManager.Silverlight"
xmlns:mycompany_Silverlight_Controls="clr-namespace:mycompany.Silverlight.Controls;assembly=mycompany.Silverlight.Controls"
x:Class="DatabaseManager.Silverlight.Views.ManageCustomerLocations"
d:DesignWidth="800" d:DesignHeight="600"
Title="ManageCustomerLocations Page">
<Grid x:Name="LayoutRoot" Background="#FFF8F8DE">
<Grid x:Name="editContainer" Margin="8,20,8,6">
<ListBox x:Name="customerList" HorizontalAlignment="Left" Margin="0,16,0,29" Width="183" SelectionChanged="CustomerSelectedEventHandler" DisplayMemberPath="CustomerName" />
<TextBox x:Name="message" Height="23" VerticalAlignment="Bottom" IsReadOnly="True" Text="{}{messages will appear here}" TextWrapping="Wrap"/>
<ListBox x:Name="customerLocations" HorizontalAlignment="Left" Margin="187,16,0,29" Width="100" SelectionChanged="CustomerLocationSelectedEventHandler" DisplayMemberPath="LocationID" />
<dataInput:Label HorizontalAlignment="Left" Margin="38,0,0,0" VerticalAlignment="Top" Width="72" Content="Customers" FontWeight="Bold" Foreground="#FF0D0D39" RenderTransformOrigin="1.153,0.562"/>
<dataInput:Label HorizontalAlignment="Left" Margin="204,0,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.567,1.562" Width="63" Content="Locations" FontWeight="Bold" Foreground="#FF0D0D39"/>
<Grid x:Name="locationContainer" Margin="291,16,0,29" IsHitTestVisible="False">
<Grid.DataContext>
<DatabaseManager_Silverlight_MasterService:CustomerLocation/>
</Grid.DataContext>
<Button x:Name="bmcKeyComputation" Margin="21,0,0,133" Content="Compute BMC Key" Click="ComputeBmcKeyEventHandler" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="132"/>
<Button x:Name="submitChanges" Margin="21,0,31,65" VerticalAlignment="Bottom" Content="Create Location" Click="PostLocationEventHandler" ToolTipService.ToolTip="This button will create/update the location record."/>
<dataInput:Label HorizontalAlignment="Left" Margin="21,0,0,181" VerticalAlignment="Bottom" Content="Location Identity:" d:LayoutOverrides="HorizontalAlignment"/>
<TextBox x:Name="locationIdentity" HorizontalAlignment="Right" Margin="0,0,31,173" TextWrapping="Wrap" VerticalAlignment="Bottom" DataContext="{Binding LocationID, Mode=TwoWay, UpdateSourceTrigger=Explicit}" ToolTipService.ToolTip="This is the name for the location (office number, cage ID, etc)"/>
<TextBox x:Name="bmcKey" HorizontalAlignment="Right" Margin="0,0,31,134" TextWrapping="Wrap" VerticalAlignment="Bottom" DataContext="{Binding BmcLocKey, Mode=TwoWay, UpdateSourceTrigger=Explicit}" IsReadOnly="True" ToolTipService.ToolTip="The resulting BMC Key generated from the previous location data"/>
<dataInput:Label Height="20" VerticalAlignment="Top" Content="Building :" HorizontalAlignment="Left" Width="71" Margin="21,63,0,0"/>
<dataInput:Label Height="21" Margin="21,104,0,0" VerticalAlignment="Top" Content="Data Center :" HorizontalAlignment="Left" Width="80"/>
<dataInput:Label Height="19" Margin="21,146,0,0" VerticalAlignment="Top" Content="Location Type :" HorizontalAlignment="Left" Width="89"/>
<mycompany_Silverlight_Controls:ComboBoxClassic x:Name="buildingList" Margin="123,63,31,0" VerticalAlignment="Top" DisplayMemberPath="{Binding Building, Mode=TwoWay, UpdateSourceTrigger=Default}" ToolTipService.ToolTip="Identifies the starting point for this location"/>
<mycompany_Silverlight_Controls:ComboBoxClassic x:Name="dataCenterList" Margin="123,104,31,0" VerticalAlignment="Top" ToolTipService.ToolTip="Provides the secondary component of the location -- this changes based on 'building'" DataContext="{Binding DataCenter, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
<mycompany_Silverlight_Controls:ComboBoxClassic x:Name="locationTypeList" Margin="123,146,31,0" VerticalAlignment="Top" ToolTipService.ToolTip="For true datacenter locations, this is the type of location the customer contracted" DataContext="{Binding LocationType, Mode=TwoWay, UpdateSourceTrigger=Explicit}"/>
</Grid>
</Grid>
</Grid>
</navigation:Page>
It's alot of code, but here is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using DatabaseManager.Silverlight.MasterService;
namespace DatabaseManager.Silverlight.Views
{
public partial class ManageCustomerLocations : Page
{
#region Page initialization logic
public ManageCustomerLocations( )
{
InitializeComponent( );
buildingList.DisplayMemberPath = "BuildingName";
buildingList.SelectedValuePath = "BuildingIdentity";
buildingList.BindingValidationError+=new EventHandler<ValidationErrorEventArgs>(buildingList_BindingValidationError);
dataCenterList.DisplayMemberPath = "DataCenterText";
dataCenterList.SelectedValuePath = "DataCenterIdentity";
dataCenterList.BindingValidationError+=new EventHandler<ValidationErrorEventArgs>(dataCenterList_BindingValidationError);
locationTypeList.DisplayMemberPath = "LocationName";
locationTypeList.SelectedValuePath = "LocationType";
locationTypeList.BindingValidationError+=new EventHandler<ValidationErrorEventArgs>(locationTypeList_BindingValidationError);
locationContainer.DataContext = new CustomerLocation( );
}
void locationTypeList_BindingValidationError( object sender, ValidationErrorEventArgs e )
{
MessageBox.Show( e.Error.Exception.Message );
}
void buildingList_BindingValidationError( object sender, ValidationErrorEventArgs e )
{
MessageBox.Show( e.Error.Exception.Message );
}
void dataCenterList_BindingValidationError( object sender, ValidationErrorEventArgs e )
{
MessageBox.Show( e.Error.Exception.Message );
}
bool InUpdateState = false;
protected override void OnNavigatedTo( NavigationEventArgs e )
{
PopulateCustomerList( );
}
private void PopulateCustomerList( )
{
DataReflectorClient client = new DataReflectorClient( );
client.OpenAsync( );
client.GetActiveCustomersCompleted += new EventHandler<GetActiveCustomersCompletedEventArgs>( ActiveCustomersEventHandler );
client.GetActiveCustomersAsync( );
client.CloseAsync( );
message.Text = "Loading active customers at this moment...please wait.";
}
#endregion
#region Database Completion Event Handlers
void GetCustomerLocationsCompletedEventHandler( object sender, GetCustomerLocationsCompletedEventArgs e )
{
customerLocations.ItemsSource = e.Result;
if ( e.Error != null )
SetWarningText( e.Error.Message );
else
SetEndingText( "Customer locations loaded successfully." );
customerLocations.UpdateLayout( );
}
void ActiveCustomersEventHandler( object sender, GetActiveCustomersCompletedEventArgs e )
{
this.customerList.ItemsSource = e.Result;
SetEndingText( "You may now choose the customer you want to work on." );
}
void GetLocationsCompleteEventHandler( object sender, GetLocationTypesCompletedEventArgs e )
{
locationTypeList.ItemsSource = e.Result;
SetEndingText( "Dropdown boxes populated." );
locationTypeList.UpdateLayout( );
}
void GetBuildingsCompleteEventHandler( object sender, GetBuildingEnumeratorsCompletedEventArgs e )
{
buildingList.ItemsSource = e.Result;
SetEndingText( "Dropdown boxes populated." );
buildingList.UpdateLayout( );
}
void LoadDataCenterEventHandler( object sender, GetDatacenterEnumeratorsCompletedEventArgs e )
{
dataCenterList.ItemsSource = e.Result;
SetEndingText( "You may now select which datacenter the customer location is at." );
dataCenterList.UpdateLayout( );
}
void HandleUpdateCompleteEventHandler( object sender, ManageCustomerLocationCompletedEventArgs e )
{
MessageResults results = e.Result as MessageResults;
if ( results == null )
SetWarningText( String.Format( "Unexpected result sent to completion event. Type of result was : {0}", e.Result.GetType( ).ToString( ) ) );
else if ( results.Status.Equals( 1 ) )
{
message.Text = String.Format( "Results: {0}", results.Message );
}
else
message.Text = String.Format( "Error: {0} Reason : {1}.....ooops.", results.ErrorMessage, results.Reason );
selectedLocation = null;
}
#endregion
#region Selection Event Handler Implementations
private void CustomerSelectedEventHandler( object sender, SelectionChangedEventArgs e )
{
customerLocations.ItemsSource = null;
if ( customerList.SelectedIndex < 0 )
{
return;
}
CustomerMaster master = customerList.SelectedItem as CustomerMaster;
if ( master == null )
{
SetWarningText( "There is a problem getting access to the selected customer." );
return;
}
DataReflectorClient client = new DataReflectorClient( );
client.OpenAsync( );
client.GetCustomerLocationsCompleted += new EventHandler<GetCustomerLocationsCompletedEventArgs>( GetCustomerLocationsCompletedEventHandler );
client.GetCustomerLocationsAsync( master.CustomerIdentity );
InUpdateState = false;
SetWarningText( "Populating dropdown boxes. Please wait...." );
client.GetBuildingEnumeratorsCompleted += new EventHandler<GetBuildingEnumeratorsCompletedEventArgs>( GetBuildingsCompleteEventHandler );
client.GetBuildingEnumeratorsAsync( );
client.GetLocationTypesCompleted += new EventHandler<GetLocationTypesCompletedEventArgs>( GetLocationsCompleteEventHandler );
client.GetLocationTypesAsync( );
client.CloseAsync( );
}
CustomerLocation selectedLocation = null;
private void CustomerLocationSelectedEventHandler( object sender, System.Windows.Controls.SelectionChangedEventArgs e )
{
if ( customerLocations.SelectedIndex < 0 )
{
}
else
{
InUpdateState = true;
selectedLocation = customerLocations.SelectedItem as CustomerLocation;
locationContainer.DataContext = selectedLocation;
SetEndingText( String.Format( "Chosen location {0} is now loaded into the editor.", selectedLocation.LocationID) );
}
}
private void BuildingSelectedEventHandler( object sender, SelectionChangedEventArgs e )
{
if ( buildingList.SelectedIndex < 0 ) return;
SetWarningText( "Getting the datacenter locations for selected building location." );
DataReflectorClient client = new DataReflectorClient( );
client.OpenAsync( );
client.GetDatacenterEnumeratorsCompleted += new EventHandler<GetDatacenterEnumeratorsCompletedEventArgs>( LoadDataCenterEventHandler );
client.GetDatacenterEnumeratorsAsync( ( ( BuildingEnumerator )buildingList.SelectedItem ).BuildingIdentity );
client.CloseAsync( );
}
private void DataCenterSelectedEventHandler( object sender, System.Windows.Controls.SelectionChangedEventArgs e )
{
if ( dataCenterList.SelectedIndex < 0 ) return;
SetEndingText( "You may now select the location type if applicable to this location." );
}
private void locationTypeList_SelectionChanged( object sender, SelectionChangedEventArgs e )
{
}
#endregion
#region Button Event handler implementations
private void ComputeBmcKeyEventHandler(object sender, System.Windows.RoutedEventArgs e)
{
message.Text = string.Empty;
BuildingEnumerator building = buildingList.SelectedItem as BuildingEnumerator;
if ( building == null )
message.Text = "You appear to have not selected a building yet. You need a building location to compute a BMC Key.";
else if ( locationIdentity.Text.Length.Equals( 0 ) )
message.Text = "You appear to have not provided a location name. Enter the location name before computing the BMC Key.";
else
bmcKey.Text = String.Concat( building.BuildingName.Substring( 0, 5 ), locationIdentity.Text );
}
private void PostLocationEventHandler(object sender, System.Windows.RoutedEventArgs e)
{
bool NoErrorsExist = true;
BuildingEnumerator building=null;
message.Text = string.Empty;
if ( buildingList.SelectedItem == null )
{
message.Text += "No building selected. ";
NoErrorsExist = false;
}
else
building = (BuildingEnumerator)buildingList.SelectedItem;
if ( dataCenterList.SelectedItem == null )
{
message.Text += "No data center selected. ";
NoErrorsExist = false;
}
if ( locationTypeList.SelectedItem==null && building != null && building.BuildingName != "Exacent" && building.BuildingName!="Office" )
{
message.Text += "No location type selected. ";
NoErrorsExist = false;
}
if ( locationIdentity.Text.Length.Equals( 0 ) )
{
message.Text = "No location name given. ";
NoErrorsExist = false;
}
if ( bmcKey.Text.Length.Equals( 0 ) && building != null && building.BuildingName != "Exacent" && building.BuildingName != "Office" )
{
message.Text = "BMC Key has not been generated. ";
NoErrorsExist = false;
}
if ( NoErrorsExist )
{
DataReflectorClient client = new DataReflectorClient( );
CustomerLocation newLocation = new CustomerLocation( );
if ( customerLocations.SelectedIndex > 0 )
newLocation = ( CustomerLocation )customerLocations.SelectedItem;
client.OpenAsync( );
if ( InUpdateState )
{
if ( newLocation.Building != ( ( BuildingEnumerator )buildingList.SelectedItem ).BuildingIdentity )
newLocation.Building = ( ( BuildingEnumerator )buildingList.SelectedItem ).BuildingIdentity;
if ( newLocation.DataCenter != ( ( DataCenterEnumerator )dataCenterList.SelectedItem ).DataCenterIdentity )
newLocation.DataCenter = ( ( DataCenterEnumerator )dataCenterList.SelectedItem ).DataCenterIdentity;
if ( newLocation.LocationType.HasValue && newLocation.LocationType.Value != ( ( LocationEnumerator )locationTypeList.SelectedItem ).LocationType )
newLocation.LocationType = ( ( LocationEnumerator )locationTypeList.SelectedItem ).LocationType;
if ( newLocation.LocationID != locationIdentity.Text )
newLocation.LocationID = locationIdentity.Text;
if ( newLocation.BmcLocKey != bmcKey.Text )
newLocation.BmcLocKey = bmcKey.Text;
client.ManageCustomerLocationCompleted += new EventHandler<ManageCustomerLocationCompletedEventArgs>( HandleUpdateCompleteEventHandler );
client.ManageCustomerLocationAsync( newLocation, RequestType.Update );
client.CloseAsync( );
}
else
{
CustomerLocation newlocation = new CustomerLocation();
newlocation.LocationIdentity = Guid.NewGuid( );
newlocation.CustomerIdentity = ( ( CustomerMaster )customerList.SelectedItem ).CustomerIdentity;
newlocation.Building = ( ( BuildingEnumerator )buildingList.SelectedItem ).BuildingIdentity;
newlocation.DataCenter = ( ( DataCenterEnumerator )dataCenterList.SelectedItem ).DataCenterIdentity;
newlocation.LocationType = locationTypeList.SelectedIndex >= 0 ? ( ( LocationEnumerator )locationTypeList.SelectedItem ).LocationType : new Nullable<int>( );
newlocation.LocationID = locationIdentity.Text;
newlocation.BmcLocKey = bmcKey.Text;
client.ManageCustomerLocationCompleted += new EventHandler<ManageCustomerLocationCompletedEventArgs>( HandleUpdateCompleteEventHandler );
client.ManageCustomerLocationAsync( newlocation, RequestType.Create );
client.CloseAsync( );
}
}
else
{
message.Text += "Please correct errors.";
return;
}
}
#endregion
void SetWarningText( string text )
{
SolidColorBrush brush = new SolidColorBrush( Colors.Red );
message.Foreground = brush;
message.Text = text;
}
void SetEndingText( string text )
{
SolidColorBrush brush = new SolidColorBrush( Colors.Black );
message.Foreground = brush;
message.Text = text;
}
}
}
|
|
|
|
|
Michael Eber wrote:
<Grid x:Name="locationContainer" Margin="291,16,0,29" IsHitTestVisible="False">
There's your problem right there.
IsHitTestVisible applies to the object and its children, and prevents it from responding to mouse events.
|
|
|
|
|