|
Hi All,
I have created the Virtual Directory on the Server and copied all .exe, xbap and manifest files, when trying to access the xbap application, I'm getting the following error. Please help me what steps am I missing in deploying the application.
Here is the Error log message
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.6.118.0 built by: NETFXREL3STAGE
clr.dll : 4.6.1076.0 built by: NETFXREL3STAGE
dfdll.dll : 4.6.118.0 built by: NETFXREL3STAGE
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
SOURCES
Deployment url : <a href="http://localhost/WPFBrowserApplication/WpfBrowserApplication12015.xbap">http:
Application url : <a href="http://localhost/WPFBrowserApplication/WpfBrowserApplication12015.exe.manifest">http:
IDENTITIES
Deployment Identity : WpfBrowserApplication12015.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c836e075e9e59aa1, processorArchitecture=msil
Application Identity : WpfBrowserApplication12015.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c836e075e9e59aa1, processorArchitecture=msil, type=win32
APPLICATION SUMMARY
* Online only application.
* Browser-hosted application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* An exception occurred while downloading the application. Following failure messages were detected:
+ Downloading <a href="http://localhost/WPFBrowserApplication/WpfBrowserApplication12015.exe.deploy">http:
+ The remote server returned an error: (404) Not Found.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
No phase information is available.
ERROR DETAILS
Following errors were detected during this operation.
* [9/18/2016 8:02:15 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
- Downloading <a href="http://localhost/WPFBrowserApplication/WpfBrowserApplication12015.exe.deploy">http:
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
at System.Deployment.Application.DeploymentManager.SynchronizeAsyncWorker()
- Inner Exception -
System.Net.WebException
- The remote server returned an error: (404) Not Found.
- Source: System
- Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
I am searching and asking with friends and colleagues, any type of help is appreciated maybe a code snippet, a link or even a suggestions help. Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
indian143 wrote: The remote server returned an error: (404) Not Found.
Either your files do not exist on your server, or you haven't configured the MIME type for them.
MIME Types for ClickOnce deployment | RobinDotNet's Blog[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I tried but I don't know how to install mime types on a Virtual Directory or Web Application, I found some vbs code I saved and ran it to install Mime types, it gave me error.
So far I couldn't find how to install MIME types, can you please help me with that?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Did you read the blog post I linked to? It has links to Microsoft's instructions for setting up MIME types in IIS.
Instructions for setting up MIME types in IIS6:
Configure MIME Types (IIS 6.0)[^]
Instructions for setting up MIME types in IIS7 (or later):
Configuring MIME Types in IIS 7[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I installed all those Mime types on my Server, still I am getting the same error, can you please give me some suggestion about it?
I have copied .exe file, .manifest file and .xbap file from bin directory of the application into Virtual Directory, am I missing anything here? Do I need to have .deploy file etc?
I followed all the steps that are provided here : GADS Open Source[^]
If I'm missing something please let me know, any help is greatly appreciated. Thanks my friend .
Still I am getting the following Error:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.42000
System.Deployment.dll : 4.6.1055.0 built by: NETFXREL2
clr.dll : 4.6.1076.0 built by: NETFXREL3STAGE
dfdll.dll : 4.6.1055.0 built by: NETFXREL2
dfshim.dll : 4.0.41209.0 (Main.041209-0000)
SOURCES
Deployment url : http://localhost/WpfBrowserApplication12015/WpfBrowserApplication12015.xbap
Application url : http://localhost/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.manifest
IDENTITIES
Deployment Identity : WpfBrowserApplication12015.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c836e075e9e59aa1, processorArchitecture=msil
Application Identity : WpfBrowserApplication12015.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c836e075e9e59aa1, processorArchitecture=msil, type=win32
APPLICATION SUMMARY
* Online only application.
* Browser-hosted application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* An exception occurred while downloading the application. Following failure messages were detected:
+ Downloading http://localhost/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.deploy did not succeed.
+ The remote server returned an error: (404) Not Found.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
No phase information is available.
ERROR DETAILS
Following errors were detected during this operation.
* [9/20/2016 2:25:44 PM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype)
- Downloading http://localhost/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.deploy did not succeed.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.DeploymentManager.SynchronizeCore(Boolean blocking)
at System.Deployment.Application.DeploymentManager.SynchronizeAsyncWorker()
- Inner Exception -
System.Net.WebException
- The remote server returned an error: (404) Not Found.
- Source: System
- Stack trace:
at System.Net.HttpWebRequest.GetResponse()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 20-Sep-16 17:32pm.
|
|
|
|
|
indian143 wrote: Downloading http://localhost/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.deploy did not succeed.
- The remote server returned an error: (404) Not Found.
Either the .deploy file does not exist in that path on your server, or you didn't configure the MIME type for .deploy files.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I configured .deploy mime type on the IIS Rick not able figure it out my friend, still checking, Silverlight Application is working on the same IIS, only WPF browser app is not working.
Do I need to set up anything in the App Config file any properties etc.? Do I need to put some Certificate related information on the Config file? I am not sure - I have been searching my friend. That one little thing can keep my Work going - thanks for coming up to help me my friend.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
If you request http://localhost/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.deploy in your web browser, do you get the file, or do you get an error?
If you get an error, try using failed request tracing[^] to diagnose the problem.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes when I type this in the browser ()[^] I am getting file not found error (404).
I don't know what it means and how to resolve it my friend, sincerely and seriously
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
So try the failed request tracing, as I suggested.
Either the file doesn't exist, or something isn't configured properly in IIS. Failed request tracing will tell you what the problem is.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have enabled the IIS request failed tracing I got the following xml file, can you please help me in finding out what I am missing when I try to make request for the .deploy as mentioned in the above message you sent me. I tried to put the message here but the thing is here its not taking the HTML message of that long. But anyways I am not able to understand why is it failing.
Can you please help in that aspect a little bit?
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type='text/xsl' href='freb.xsl'?>
<!-- saved from url=(0014)about:internet -->
<failedRequest url="http://localhost:80/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.deploy"
siteId="1"
appPoolId="WPF Browser App Pool"
processId="9100"
verb="GET"
remoteUserName=""
userName=""
tokenUserName="NT AUTHORITY\IUSR"
authenticationType="anonymous"
activityId="{00000000-0000-0000-0600-0080020000FF}"
failureReason="STATUS_CODE"
statusCode="404"
triggerStatusCode="404"
timeTaken="62"
xmlns:freb="http://schemas.microsoft.com/win/2006/06/iis/freb"
>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<version>1
<level>0
<opcode>1
<keywords>0x0
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="SiteId">1</Data>
<Data Name="AppPoolId">WPF Browser App Pool</Data>
<Data Name="ConnId">1610612741</Data>
<Data Name="RawConnId">0</Data>
<Data Name="RequestURL">http:
<Data Name="RequestVerb">GET</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>GENERAL_REQUEST_START</Opcode>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{D42CF7EF-DE92-473E-8B6C-621EA663113A}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>4</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="ModuleName">FailedRequestsTracingModule</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PRE_BEGIN_REQUEST_START</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>5</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="ModuleName">FailedRequestsTracingModule</Data>
<Data Name="NotificationStatus">0</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PRE_BEGIN_REQUEST_END</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="NotificationStatus">NOTIFICATION_CONTINUE</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>4</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="ModuleName">RequestMonitorModule</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PRE_BEGIN_REQUEST_START</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>5</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Not without seeing the full file.
If you open the XML file in Internet Explorer, you should see a detailed log of the failed request, and the breakdown of what caused the error.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
xml file is too big, can you please give me some hints where to look or some searching criteria mostly its saying 400 error and not saying which file is missing my friend. I know its kind of bugging for you.
If you can help me its really great - thank you.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
If you open the XML file in Internet Explorer, you will get a formatted list of errors and warnings.
If you can't work out what they mean, then post the file to a new GitHub Gist[^] and provide the link.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a situation where I am trying to change the visibility of StackPanels in a child UserControl from a button in the parent window. I created a custom class below that holds a static reference to the UserControl value and in the UserControl View constructor the user control value is assigned to the static EditWindow class uc static value. Now what I am trying to do is hide and show StackPanels in the child UserControl view the button in the parent window is clicked. When the button is clicked the StackPanels are not changing from Collapsed to Visible. All of the code is below:
EditWindow.cs
public static class EditWindow
{
public static string buttonString;
public static Button button;
public static View.ApplicationInfoView uc;
}
<v:ApplicationInfoView />
ApplicationInfoView StackPanels
<StackPanel Name="Sp1">
<StackPanel Name="Sp2">
<StackPanel Name="Sp2">
EditWindow.uc = this;
private void btnEdit_Click(object sender, RoutedEventArgs)
{
EditWindow.uc.editAppInfo();
}
editAppInfo()
{
EditWindow.uc.sp1.Visibility = Visibility.Collapsed;
EditWindow.uc.sp2.Visibility = Visibility.Visible;
EditWindow.uc.sp3.Visibility = Visibility.Visibile;
}
|
|
|
|
|
If the StackPanels are "empty", toggling visibility will make no difference unless you use an explicit minimum height, width and / or color in order to "see" them.
Also, the layout (right or wrong) impacts what one sees (in-back versus in-front; etc); regardless of what the "code-behind" is doing.
|
|
|
|
|
I have now tried changing the way I am performing my task. Now in my child user control constructor I am loading the UserControl as follows:
// Remember EditWindow is a static class and uc is a static // public value of View.ApplicationInfoView which is the // UserControl that is a View with a base class of // UserControl.
EditWindow.uc = this;
And now calling the method the following on the parent window button click event:
// Remember the StackPanel spGrid is Collapsed onload
private void btn_click(object sender, RoutingEventArgs e)
{
EditWindow.uc.spGrid.Visibility = Visibility.Visible;
}
Now Here is my StackPanel on the child UserControl:
<StackPanel Name="spGrid" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="2">
<Grid Name="Grid2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="425" />
<ColumnDefinition Width="425" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
</Grid.RowDefinitions>
<Label Height="36" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="16" Background="#FF004A78" Content="Identifying Documents" FontWeight="Bold" Foreground="White" Margin="0,0,0,0"/>
<StackPanel Grid.Row="1" Grid.Column="0" >
<Border BorderBrush="White" BorderThickness="3">
<Border BorderBrush="Gray" BorderThickness="1">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<StackPanel Width="420" x:Name="_Passport" Margin="0,0,0,0" Height="65">
<StackPanel Orientation="Horizontal">
<TextBlock Height="45" Width="Auto" FontWeight="Bold" Foreground="#FF004A78" FontSize="18" x:Name="Passport_TextBlock" Text="Passport" TextAlignment="Left"/>
<Image Source="/Images/Attachments_button.jpg" Margin="180, 0, 0 ,0" MouseLeftButtonUp="Click_MouseLeftButtonUp" Name="PPTop" Width="Auto" Height="45" />
<Image Source="/Images/Attachments_button.jpg" Margin="50, 0, 0 ,0" Name="PPBottom" Width="Auto" Height="45" />
</StackPanel>
<TextBlock Height="20" Width="Auto" Foreground="#FF004A78" FontSize="12" TextWrapping="WrapWithOverflow" x:Name="Passport2_TextBlock" Text="(Color copy, top and bottom) Perferred Passport Top Passport Bottom" TextAlignment="Left"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</Border>
</StackPanel>
</StackPanel>
</Grid>
</StackPanel>
Now, again the StackPanel I am trying to hide/show is Name="spGrid". It houses my Grid "Grid2". Now this StackPanel is housed in it's own Grid. Shown is the nested Grid. Also, I am only showing you only one of the rows in the nested Grid of StackPanel spGrid. The other rows have the same type of controls. Again I don't know why when my EditWindow static class's UserControl uc set's it's StackPanel spGrid to visible it stil stays hidden.
|
|
|
|
|
This is one of those situations where the XAML should be "re-considered". (The "depth" of this simple visual tree is sure ... "deep"...)
Even your top "stack panel" is imbedded in a Grid; so you've still not got the whole picture.
State what you're trying to do from a "user" / functional point-of-view, and you'll probably get some good design answers to get you off with a less "complicated" (XAML) design / approach.
|
|
|
|
|
The appropriate way to do this is to create a Tunnelling Routed Event that the Child User control listens to. And make that event fire when you click the button on the parent control. This article on MSDN explains how to declare a Routed Event
|
|
|
|
|
Hi All,
I am using a Silverlight listbox on which I display some integers, when I select a particular item of listbox (ie integer), it has to show me the value of that integer. Showing part is working perfect but the problem is when I select one item and then go to another item, silverligh is not clearing the selection of the first one instead keeping the selection on both, which looks weird to customer, any help is appreciated.
Here is my xaml
<UserControl x:Class="RollDiceApp.MainPage"
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"
d:DesignHeight="300" d:DesignWidth="300"
xmlns:local="clr-namespace:RollDiceApp"
xmlns:viewmodel="clr-namespace:RollDiceApp.ViewModel"
Height="650" Width="700"
Name="diceGamePage"
>
<UserControl.DataContext>
<viewmodel:DiceGameViewModel x:Name="_diceGameViewModel"
/>
</UserControl.DataContext>
<pre>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition Width="76.988"></ColumnDefinition>
</Grid.ColumnDefinitions>
<ListBox x:Name="lblHistory" Margin="1.988,40.96,10,10" Grid.Column="1" FontSize="21.333"
FontWeight="Bold" FontStyle="Italic"
ItemsSource="{Binding Items}"
SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" SelectionMode="Single" >
</ListBox>
<Button x:Name="cmdRollDice" Content="Roll Dice" VerticalAlignment="Top" Margin="12,13,0,0" HorizontalAlignment="Left" Width="65"
Command="{Binding Path=ClickSaveCommand}" >
</Button>
<Button x:Name="cmdClearAllDice" Content="Clear All Dice" VerticalAlignment="Top" Margin="610,13,-2,0" HorizontalAlignment="Left" Width="92"
Command="{Binding Path=ClearHistoryCommand}" Grid.ColumnSpan="2" >
</Button>
<Image x:Name="imgDice" Margin="10, 42.97,10,10" Source="{Binding ImageSourcePath}" />
</Grid>
Here is my ViewModel
namespace RollDiceApp.ViewModel
{
public class DiceGameViewModel : INotifyPropertyChanged, IDataErrorInfo
{
public DiceGameViewModel()
{
_items = new ObservableCollection<int>();
_imageSourcePath = string.Empty;
}
private string GetNewImagePath(int v)
{
if ((v == null) || (v <= 0))
v = 1;
return HelperMethods.GetRootDirectory() + @"/Images/" + v.ToString() + ".jpg";
}
private int GetRandom(int min, int max)
{
Random generator = new Random();
return generator.Next(min, max);
}
private string _imageSourcePath;
public string ImageSourcePath {
get { return _imageSourcePath; }
set
{
_imageSourcePath = value;
NotifyPropertyChanged("ImageSourcePath");
}
}
private ObservableCollection<int> _items;
public ObservableCollection <int> Items
{
get { return _items; }
set
{
_items = value;
NotifyPropertyChanged("Items");
}
}
private int _selecteditem;
public int SelectedItem {
get { return _selecteditem; }
set
{<br />
_selecteditem = value;
NotifyPropertyChanged("SelectedItem");
DisplayNewDiceValue(value);
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if(null!=handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
private void DisplayNewDiceValue(int val)
{
ImageSourcePath = GetNewImagePath(val);
NotifyPropertyChanged("ImageSourcePath");
}
private void DisplayHistory(int val)
{
_items.Add(val);
NotifyPropertyChanged("ImageSourcePath");
}
private void ClickRollDice()
{
int i = GetRandom(1, 6);
DisplayNewDiceValue(i);
DisplayHistory(i);
}
private void CmdClearHistory()
{
_items.Clear();
ImageSourcePath = "";
NotifyPropertyChanged("ImageSourcePath");
}
private ICommand _clickSaveCommand;
public ICommand ClickSaveCommand {
get { return _clickSaveCommand ??
(_clickSaveCommand = new RollDiceApp.ViewModel.Command.RollDiceCommand(() => ClickRollDice(), true));
} }
private ICommand _clearHistoryCommand;
public ICommand ClearHistoryCommand
{
get
{
return _clickSaveCommand ??
(_clickSaveCommand = new RollDiceApp.ViewModel.Command.RollDiceCommand(() => CmdClearHistory(), true));
}
}
string IDataErrorInfo.this[string columnName]
{
get
{
throw new NotImplementedException();
}
}
string IDataErrorInfo.Error
{
get
{
throw new NotImplementedException();
}
}
}
}
Here is my Command
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace RollDiceApp.ViewModel.Command
{
public class RollDiceCommand : ICommand
{
private Action _action;
private Boolean _canExecute;
public RollDiceCommand(Action _action, Boolean _canExecute)
{
this._action = _action;
this._canExecute = _canExecute;
}
bool ICommand.CanExecute(object parameter)
{
return _canExecute;
}
public event EventHandler CanExecuteChanged;
void ICommand.Execute(object parameter)
{
_action();
}
}
}
Here is my other class
namespace RollDiceApp
{
public class HelperMethods
{
public static string GetRootDirectory()
{
string uriPath = Application.Current.Host.Source.ToString();
Uri uri = new Uri(uriPath);
Uri parent = new Uri(uri, "..");
return parent.ToString();
}
}
}
Here is my App.xaml
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="RollDiceApp.App"
<pre>
>
<Application.Resources>
</Application.Resources>
There are 6 images in images folder with names 1.jpg to 6.jpg, you can create any Images for that.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi All,
I have created xbap application and moved the xbap, exe and manifest files into wwroot folder.
Now to be able to use/call this xbap file from clients browser, I have few questions
- do I need to create a html file to call this xbap from browser? If I need to, can you please give me the sample tags how to call?
- I tried to call xbap it looked like it was executing but did not, it seems like certificates or permissions are the issue, if I want to give certificate or permissions, how can I do it on the Virtual directory? I am using IIS 7
- Do I need to install MIME types on IIS to exec my xbap file? Reason is I got a script from msdn which installs it but it was giving me error, if I need to have them installed, is there any better and guaranteed approach to do the same on IIS 7.
I am searching and inquiring with friends and colleagues but anything helps a small code snippet, a link or even a suggestion helps.
Thanks in advance my friends.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hello,
i'm working with expanders in MVVM and i trying to get notification in the viewmodel when the expander is already opened and when it's opened i want to make print screen to the expander content.
and the scenario is like this:
1)i open the expander that binded to IsExpanderOpen property in the VM and fill the details i want
2)i close the expander (don't ask why it's only example)
3)press OK to save the details of expander controls in DB
4)the OK i pressed call to realycommand 'OpenExpander()' that execute the line IsExpanderOpen=true
5)then i make print screen to the content of opened expander(but it captures closed expander)
this scenario doesn't work because the viewmodel doesn't know to wait the xaml to be rendered when the expander is opended.
i don't want code behind so is there any way to know when the ui is already render the operation
and only then to trigger the viewmodel?
|
|
|
|
|
I haven't tested this but I would imagine it would be as simple as binding an to the Expanded event (can be done with an EventToCommand). However, if it takes the inner content a while to load up; e.g. because you are lazy loading, then you need to transfer the print logic to wait for that instead.
This space for rent
|
|
|
|
|
Ok look this is the code of xaml i use event with command and also send the expander as parameter
<expander x:name="AExpander" margin="0,0,0,5" isexpanded="{Binding SectionAExpander}"
="" isenabled="{Binding WasAppNumEntered}" style="{StaticResource LsExpander}">
<behaviors:commandbehaviorcollection.behaviors>
<behaviors:behaviorbinding event="Expanded" command="{Binding OnExpandedCommand}" commandparameter="{Binding ElementName=AExpander}">
<expander.header>
and this is the viewmodel code:
1) this is the command that binded to xaml
public ICommand OnExpandedCommand
{
get
{
if (_onExpandedCommand == null)
{
_onExpandedCommand = new RelayCommand(OnExpanderOpened);
}
return _onExpandedCommand;
}
}
2)this is the function OnExpanderOpened:
private Expander expanderA;
private void OnExpanderOpened(object obj)
{
expanderA = (Expander)obj;
if (expanderA.IsExpanded)//show true
{
CanPrintDataEntry = true;//attached property that call to the print screen function
}
}
so you see expanderA show that it's opened but the render happens after it is true in the VM
and i get print screen with closed expander so is there any way to notify
the viewmodel AFTER xaml is rendered
thank you
|
|
|
|
|
Okay, then you are going to have to get to the ContentRendered event (not easily done I'm afraid). To do this, if I were you, I would create a behavior that behaved something like this internally:
AssociatedObject.Loaded += LoadedEvent;
private void LoadedEvent(object sender, RoutedEventArgs e)
{
PresentationSource presentationSource = PresentationSource.FromVisual((Visual)sender);
presentationSource.ContentRendered += ContentRenderedHandler;
}
private void ContentRenderedHandler(object sender, EventArgs e)
{
((PresentationSource)sender).ContentRendered -= ContentRenderedHandler;
}
This space for rent
|
|
|
|
|