|
Hi I have created a windows phone app 7.1 that counts the taps, it has a reset button as well, I have coded it and no errors are showing, the app opens perfectly in the emulator but when you tap the screen no count happens, I have been through the code so many time Im nearly dizzy .
anyone who can spot anything wrong would very much appreciated.
--------------------------
MainPage.xaml.cs
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 Microsoft.Phone.Controls;
namespace PhoneAppSolution
{
public partial class MainPage : PhoneApplicationPage
{
int count = 0;
Setting<int> savedCount = new Setting<int>("SavedCount", 0);
public MainPage()
{
InitializeComponent();
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
this.count++;
this.CountTextBlock.Text = this.count.ToString("NO");
}
void ResetButton_Click(object sender, RoutedEventArgs e)
{
this.count = 0;
this.CountTextBlock.Text = this.count.ToString("NO");
}
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
this.savedCount.Value = this.count;
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
this.count = this.savedCount.Value;
this.CountTextBlock.Text = this.count.ToString("NO");
}
}
}
-----------------------------------------------------------
Setting.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.IsolatedStorage;
namespace PhoneAppSolution
{
public class Setting<num>
{
string name;
num value;
num defaultValue;
bool hasValue;
public Setting(string name, num defaultValue)
{
this.name = name;
this.defaultValue = defaultValue;
}
public num Value
{
get
{
if(!this.hasValue)
{
if (!IsolatedStorageSettings.ApplicationSettings.TryGetValue(
this.name, out this.value))
{
this.value = this.defaultValue;
IsolatedStorageSettings.ApplicationSettings[this.name] = this.value;
}
this.hasValue = true;
}
return this.value;
}
set
{
IsolatedStorageSettings.ApplicationSettings[this.name] = value;
this.value = value;
this.hasValue = true;
}
}
public num DefaultValue
{
get { return this.DefaultValue; }
}
public void ForceRefresh()
{
this.hasValue = false;
}
}
}
--------------------------------------------------------------
MainPage.xaml
<phone:PhoneApplicationPage
x:Class="PhoneAppSolution.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeHuge}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Margin="12,17,0,28" Grid.ColumnSpan="2">
<TextBlock x:Name="ApplicationTitle" Text="Tally" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="tap to count" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<TextBlock x:Name="CountTextBlock" Grid.Row="1" TextAlignment="Center" Text="0" Grid.ColumnSpan="2" />
<Button x:Name="ResetButton" Grid.Row="1" Click="ResetButton_Click" Content="reset" Margin="21,343,1,143" />
</Grid>
</phone:PhoneApplicationPage>
Any help really appreciated.
Paddy
|
|
|
|
|
Your event handler signature looks wrong. They should look something like this:
private void button1_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("button click");
}
private void ContentPanel_Tap(object sender, GestureEventArgs e)
{
MessageBox.Show("tap");
}
Have you wired up the handlers somewhere? You can do this in the designer's property grid by selecting the Events tab. Double-Click on an event name and it will create the code stub for you.
|
|
|
|
|
Quote: on web site it will automatic detect profile at web config, so how to make web application can detect, anyone can help me it very hard for me?
based on this example if convert to web applicaion, it also cant detect profile at webconfig,so how to slove it
any kind person can download this example http://csharpdotnetfreak.blogspot.com/2009/05/aspnet-creating-shopping-cart-example.html[^]and convert the profile to web application make sure it able to detect
|
|
|
|
|
That's not going to happen. Nobody is going to do your work for you.
|
|
|
|
|
ok tell me why it cant detect inside the excample it ady have a class file
|
|
|
|
|
I have no idea what you just said. It makes no sense at all.
|
|
|
|
|
As you have been told, we aren't going to download the file, and we aren't going to do your work for you.
As you have also been told, what you are saying doesn't make a whole lot of sense.
So...try this: take a step back, and pretend you know nothing about your project.
Now close your eyes so you can't see your screen, and disconnect your PC from your network.
Now you are in the state we are: we can't see your screen. We can't access your HDD. And very few of us can read your mind.
So, without opening your eyes or plugging your computer back onto the network try to work out a description of your problem which fits what you can see. and then type it up for us so we can understand what you are trying to do, and how you are trying to do it. Then explain what help you need, with relevant code fragments in necessary.
But until you do that, there isn't a lot we can do to help you!
|
|
|
|
|
ok sry sir
modified 22-Nov-13 14:13pm.
|
|
|
|
|
Hi All.
We develop a many windows application with different goals such as a Financial System, Clinic system, POS System, .... etc.
My issue is we don't need to create the users and the security part in each system, this mean we don't need to develop the user definition and the rights in each system.
we need a one centralized system the used as a dll and use it in the whole projects and use it to define users, rights and permissions, grant or deny a user permission.
please help me if you can how to design this system.
please not we use the c# windows applications
Thanks All.
|
|
|
|
|
It's called Single Sign On. You could study the architecture of providers such as Tivoli.
|
|
|
|
|
Thanks,
Do you have any links or topics about single sign on.
|
|
|
|
|
Yes[^]. About 1,670,000,000 results.
|
|
|
|
|
Well, I couldn't understand what you want. Could you tell me more clearly? 
|
|
|
|
|
Hi,
I want to centralize the users creation and permissions grant and use the system for all systems.
We create a specific user definitions and authentication module for each system and this take a time and cost.
Thanks for your care.
|
|
|
|
|
|
In the old days, yes. Have you seen the VS2013 IDE? One can "sign in" using the passport. Google has it's OAuth that kinda signs you in.
Next thing to privatize; proving one's identity.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah, you can use any authentication source. It's more of a matter of what his requirements and environment allows. Only he can answer that question.
|
|
|
|
|
Hello all,
Im trying to learn on how to create a cube mesh via coding. Yet i seem to be stuck at making it.
This is what i got right now..
for(int i = 0; i < xSize; i++){
for(int y = 0; y < ySize; y++){
for(int j = 0; j < zSize;j++){
GenerateSphere(i * seperationX,y * seperationY, j*seperationZ);
newVertices[ConvertToArrayIndex(i,j,xSize)] = new Vector3(i * seperationX, y * seperationY,j * seperationZ);
Debug.Log (ConvertToArrayIndex(i,y,xSize));
int counter = 0;
if((i < xSize - 1) && y < (ySize - 1) && j < (zSize - 1)) {
newTriangles[counter] = ConvertToArrayIndex(i,j,xSize);
counter++;
newTriangles[counter] = ConvertToArrayIndex(i ,j + 1,xSize);
counter++;
newTriangles[counter] = ConvertToArrayIndex(i + 1,j,xSize);
counter++;
newTriangles[counter] = ConvertToArrayIndex(i+ 1 ,j+1,xSize);
counter++;
newTriangles[counter] = ConvertToArrayIndex(i + 1,j,xSize);
counter++;
newTriangles[counter] = ConvertToArrayIndex(i,j + 1,xSize);
counter++;
}
}
}
}
myMesh.vertices = newVertices;
myMesh.triangles = newTriangles;
GetComponent<MeshFilter>().mesh = myMesh;
}
void GenerateSphere(float x,float y,float z){
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.localPosition = new Vector3(x,y,z);
sphere.transform.localScale = new Vector3(0.1f,0.1f,0.1f) ;
}
int ConvertToArrayIndex(int i, int j, int size){
return j +size * i;
}
I just need help, its not a homework or anything please.. Im just confused on how to continue..
|
|
|
|
|
begginerc2 wrote: Im just confused on how to continue. You could start by editing the above post and explaining what that code is supposed to do, and what is failing.
Veni, vidi, abiit domum
|
|
|
|
|
hello
can you help me?
I Want to get text format from pdf file or docx file
thanks
|
|
|
|
|
You already asked this question below, and received a good suggestion. Go and talk to the people who wrote the docx library.
Veni, vidi, abiit domum
|
|
|
|
|
Richard MacCutchan wrote: You already asked this question below
Not to mention the QA question[^] from yesterday.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi, can anyone clear me what is the difference between System and Object class?? From which our all classes are inherit?? Is there any Object class in c sharp like java?
|
|
|
|
|
There is no System class, its a namespace in C# which contains other namespaces and classes.
There is an object class, oddly enough, called System.Object (or System.object). Its the class from which all .NET classes/objects/structures/delegates and enumerations derive from.
|
|
|
|
|
|