Goldshit Init

This commit is contained in:
BlubbFish 2011-10-24 17:04:37 +00:00
parent d66bc8839d
commit e2de14cb70
22 changed files with 943 additions and 0 deletions

22
GoldShit/GoldShit.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GoldShit", "GoldShit\GoldShit.csproj", "{374ED675-2D42-4068-A504-52A9138E6278}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{374ED675-2D42-4068-A504-52A9138E6278}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{374ED675-2D42-4068-A504-52A9138E6278}.Debug|Any CPU.Build.0 = Debug|Any CPU
{374ED675-2D42-4068-A504-52A9138E6278}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{374ED675-2D42-4068-A504-52A9138E6278}.Release|Any CPU.ActiveCfg = Release|Any CPU
{374ED675-2D42-4068-A504-52A9138E6278}.Release|Any CPU.Build.0 = Release|Any CPU
{374ED675-2D42-4068-A504-52A9138E6278}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,19 @@
<Application
x:Class="GoldShit.App"
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">
<!--Anwendungsressourcen-->
<Application.Resources>
</Application.Resources>
<Application.ApplicationLifetimeObjects>
<!--Erforderliches Objekt, das Lebensdauerereignisse der Anwendung behandelt-->
<shell:PhoneApplicationService
Launching="Application_Launching" Closing="Application_Closing"
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
</Application>

View File

@ -0,0 +1,148 @@
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.Navigation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
namespace GoldShit
{
public partial class App : Application
{
/// <summary>
/// Bietet einen einfachen Zugriff auf den Stammframe der Phone-Anwendung.
/// </summary>
/// <returns>Der Stammframe der Phone-Anwendung.</returns>
public PhoneApplicationFrame RootFrame { get; private set; }
/// <summary>
/// Konstruktor für das Application-Objekt.
/// </summary>
public App()
{
// Globaler Handler für nicht abgefangene Ausnahmen.
UnhandledException += Application_UnhandledException;
// Silverlight-Standardinitialisierung
InitializeComponent();
// Phone-spezifische Initialisierung
InitializePhoneApplication();
// Während des Debuggens Profilerstellungsinformationen zur Grafikleistung anzeigen.
if (System.Diagnostics.Debugger.IsAttached)
{
// Zähler für die aktuelle Bildrate anzeigen.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
// Bereiche der Anwendung hervorheben, die mit jedem Bild neu gezeichnet werden.
//Application.Current.Host.Settings.EnableRedrawRegions = true;
// Nicht produktiven Visualisierungsmodus für die Analyse aktivieren,
// in dem Bereiche einer Seite angezeigt werden, die mit einer Farbüberlagerung an die GPU übergeben wurden.
//Application.Current.Host.Settings.EnableCacheVisualization = true;
// Deaktivieren Sie die Leerlauferkennung der Anwendung, indem Sie die UserIdleDetectionMode-Eigenschaft des
// PhoneApplicationService-Objekts der Anwendung auf "Disabled" festlegen.
// Vorsicht: Nur im Debugmodus verwenden. Eine Anwendung mit deaktivierter Benutzerleerlauferkennung wird weiterhin ausgeführt
// und verbraucht auch dann Akkuenergie, wenn der Benutzer das Handy nicht verwendet.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
using (PoopDataContext db = new PoopDataContext(PoopDataContext.DBConnectionString))
{
if (db.DatabaseExists() == false)
{
db.CreateDatabase();
}
}
}
// Code, der beim Starten der Anwendung ausgeführt werden soll (z. B. über "Start")
// Dieser Code wird beim Reaktivieren der Anwendung nicht ausgeführt
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code, der ausgeführt werden soll, wenn die Anwendung aktiviert wird (in den Vordergrund gebracht wird)
// Dieser Code wird beim ersten Starten der Anwendung nicht ausgeführt
private void Application_Activated(object sender, ActivatedEventArgs e)
{
}
// Code, der ausgeführt werden soll, wenn die Anwendung deaktiviert wird (in den Hintergrund gebracht wird)
// Dieser Code wird beim Schließen der Anwendung nicht ausgeführt
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}
// Code, der beim Schließen der Anwendung ausgeführt wird (z. B. wenn der Benutzer auf "Zurück" klickt)
// Dieser Code wird beim Deaktivieren der Anwendung nicht ausgeführt
private void Application_Closing(object sender, ClosingEventArgs e)
{
}
// Code, der bei einem Navigationsfehler ausgeführt wird
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// Navigationsfehler. Unterbrechen und Debugger öffnen
System.Diagnostics.Debugger.Break();
}
}
// Code, der bei nicht behandelten Ausnahmen ausgeführt wird
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// Eine nicht behandelte Ausnahme ist aufgetreten. Unterbrechen und Debugger öffnen
System.Diagnostics.Debugger.Break();
}
}
#region Initialisierung der Phone-Anwendung
// Doppelte Initialisierung vermeiden
private bool phoneApplicationInitialized = false;
// Fügen Sie keinen zusätzlichen Code zu dieser Methode hinzu
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Frame erstellen, aber noch nicht als RootVisual festlegen. Dadurch kann der Begrüßungsbildschirm
// aktiv bleiben, bis die Anwendung bereit für das Rendern ist.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Navigationsfehler behandeln
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Sicherstellen, dass keine erneute Initialisierung erfolgt
phoneApplicationInitialized = true;
}
// Fügen Sie keinen zusätzlichen Code zu dieser Methode hinzu
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
{
// Visuelle Stammkomponente festlegen, sodass die Anwendung gerendert werden kann
if (RootVisual != RootFrame)
RootVisual = RootFrame;
// Dieser Handler wird nicht mehr benötigt und kann entfernt werden
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
#endregion
}
}

View File

@ -0,0 +1,103 @@
using System;
using System.IO.IsolatedStorage;
using System.Diagnostics;
using System.Collections.Generic;
namespace GoldShit
{
public class AppSettings
{
IsolatedStorageSettings settings;
const string SettingsWageKeyName = "SettingsWage";
const string SettingsHourlyKeyName = "SettingsHourly";
const string SettingsSalaryKeyName = "SettingsSalary";
const double SettingsWageDefault = 9.44;
const bool SettingsHourlyDefault = true;
const bool SettingsSalaryDefault = false;
public AppSettings()
{
settings = IsolatedStorageSettings.ApplicationSettings;
}
public bool AddOrUpdateValue(string Key, Object value)
{
bool valueChanged = false;
if (settings.Contains(Key))
{
if (settings[Key] != value)
{
settings[Key] = value;
valueChanged = true;
}
}
else
{
settings.Add(Key, value);
valueChanged = true;
}
return valueChanged;
}
public T GetValueOrDefault<T>(string Key, T defaultValue)
{
T value;
if (settings.Contains(Key))
{
value = (T)settings[Key];
}
else
{
value = defaultValue;
}
return value;
}
public void Save()
{
settings.Save();
}
public double SettingsWage
{
get
{
return GetValueOrDefault<double>(SettingsWageKeyName, SettingsWageDefault);
}
set
{
if (AddOrUpdateValue(SettingsWageKeyName, value))
{
Save();
}
}
}
public bool SettingsHourly
{
get
{
return GetValueOrDefault<bool>(SettingsHourlyKeyName, SettingsHourlyDefault);
}
set
{
if (AddOrUpdateValue(SettingsHourlyKeyName, value))
{
Save();
}
}
}
public bool SettingsSalary
{
get
{
return GetValueOrDefault<bool>(SettingsSalaryKeyName, SettingsSalaryDefault);
}
set
{
if (AddOrUpdateValue(SettingsSalaryKeyName, value))
{
Save();
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{374ED675-2D42-4068-A504-52A9138E6278}</ProjectGuid>
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GoldShit</RootNamespace>
<AssemblyName>GoldShit</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>GoldShit.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>GoldShit.App</SilverlightAppEntry>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<Utf8Output>true</Utf8Output>
<ExpressionBlendVersion>4.0.30816.0</ExpressionBlendVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Phone" />
<Reference Include="Microsoft.Phone.Interop" />
<Reference Include="system.data.linq" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="mscorlib.extensions" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="AppSettings.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="PoopItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
<None Include="Properties\WMAppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="ApplicationIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.back.rest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.favs.rest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.feature.settings.rest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="icons\appbar.stat.rest.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions />
</Project>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{C089C8C0-30E0-4E22-80C0-CE093F111A43}">
<SilverlightMobileCSProjectFlavor>
<FullDeploy>False</FullDeploy>
</SilverlightMobileCSProjectFlavor>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

View File

@ -0,0 +1,110 @@
<phone:PhoneApplicationPage
x:Class="GoldShit.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="696"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar>
<shell:ApplicationBarIconButton Click="ApplicationBarIconButton_Click" IconUri="/icons/appbar.feature.settings.rest.png" Text="settings"/>
<shell:ApplicationBarIconButton Click="ApplicationBarIconButton_Click_1" IconUri="/icons/appbar.stat.rest.png" Text="stats"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="Poop Salary" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Timer" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Click="bstart_Click" x:Name="bstart" Content="Start Pooping" Margin="10,230,10,0" d:LayoutOverrides="Width, Height" VerticalAlignment="Top"/>
<Button Click="bstop_Click" x:Name="bstop" Content="Back to work" Margin="10,300,10,0" VerticalAlignment="Top" d:LayoutOverrides="Width" IsEnabled="False"/>
<TextBlock x:Name="ttime" Margin="10,10,10,0" TextWrapping="Wrap" Text="00:00" TextAlignment="Center" VerticalAlignment="Top" FontSize="64"/>
<TextBlock x:Name="tmoney" Margin="10,108,10,0" TextWrapping="Wrap" Text="$0.00" VerticalAlignment="Top" d:LayoutOverrides="Width" TextAlignment="Center" FontSize="26.667"/>
<Border x:Name="bsettings" BorderThickness="2" Margin="0,150,0,0" Visibility="Collapsed" Canvas.ZIndex="1">
<Border.BorderBrush>
<SolidColorBrush Color="{StaticResource PhoneBorderColor}"/>
</Border.BorderBrush>
<Border.Background>
<SolidColorBrush Color="#FF000000" Opacity="0.95"/>
</Border.Background>
<Grid x:Name="gsettings">
<TextBox x:Name="tsettingswage" TextWrapping="Wrap" Text="9.44" VerticalAlignment="Top" Margin="100,200,0,0" InputScope="Number"/>
<TextBlock HorizontalAlignment="Left" Margin="10,225,0,0" TextWrapping="Wrap" Text="Wage" VerticalAlignment="Top"/>
<RadioButton x:Name="tsettingshourly" Content="Hourly / hr" Margin="10,10,10,0" VerticalAlignment="Top" d:LayoutOverrides="Width" IsChecked="True" GroupName="settings"/>
<RadioButton x:Name="tsettingssalary" Content="Salary / yr" Margin="10,80,10,0" VerticalAlignment="Top" d:LayoutOverrides="Width" GroupName="settings"/>
<Button Click="tsettingssave_Click" x:Name="tsettingssave" Content="Save" Margin="0,290,0,0" VerticalAlignment="Top"/>
</Grid>
</Border>
<Border x:Name="bstat" BorderThickness="2" Visibility="Collapsed">
<Border.BorderBrush>
<SolidColorBrush Color="{StaticResource PhoneBorderColor}"/>
</Border.BorderBrush>
<Border.Background>
<SolidColorBrush Color="{StaticResource PhoneBackgroundColor}" Opacity="0.95"/>
</Border.Background>
<Grid Margin="0">
<Button x:Name="bstatdate" Content="Date" Margin="0,0,302,0" VerticalAlignment="Top"/>
<Button x:Name="bstattime" Content="Time" Margin="150,0" d:LayoutOverrides="Width, Height" VerticalAlignment="Top"/>
<Button x:Name="bstatmoney" Content="$$$" Margin="302,0,0,0" d:LayoutOverrides="Width, Height" VerticalAlignment="Top"/>
<ListBox x:Name="bstatsall" Margin="10,69,10,296" Grid.ColumnSpan="3" BorderThickness="1">
<ListBox.BorderBrush>
<SolidColorBrush Color="{StaticResource PhoneBorderColor}"/>
</ListBox.BorderBrush>
<Grid Margin="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="152"/>
<ColumnDefinition Width="140"/>
</Grid.ColumnDefinitions>
<ListBoxItem Content="Date" Margin="4,0,13,0"/>
<ListBoxItem Content="Time" Grid.Column="1" Margin="13,0"/>
<ListBoxItem Content="Money" Grid.Column="2" Margin="13,0,4,0" />
</Grid>
</ListBox>
<Button Click="tstatclose_Click" x:Name="tstatclose" Content="Close" Margin="10,0,10,10" VerticalAlignment="Bottom" d:LayoutOverrides="Width"/>
<Button Click="tstatreset_Click" x:Name="tstatreset" Content="Reset" Margin="10,0,10,76" VerticalAlignment="Bottom">
<Button.Background>
<SolidColorBrush Color="#7FB40000"/>
</Button.Background>
</Button>
<TextBlock HorizontalAlignment="Left" Margin="10,245,0,0" TextWrapping="Wrap" Text="Highscore" d:LayoutOverrides="Height" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="35,290,0,0" TextWrapping="Wrap" Text="Money Earned:" VerticalAlignment="Top" FontSize="16"/>
<TextBlock x:Name="tstattotalmoney" Margin="190,290,0,0" TextWrapping="Wrap" Text="$0.00" VerticalAlignment="Top" d:LayoutOverrides="Width" FontSize="16" HorizontalAlignment="Left"/>
<TextBlock HorizontalAlignment="Left" Margin="35,315,0,0" TextWrapping="Wrap" Text="Time Waist:" VerticalAlignment="Top" FontSize="16"/>
<TextBlock x:Name="tstattotaltime" Margin="190,315,0,0" TextWrapping="Wrap" Text="00:00" VerticalAlignment="Top" d:LayoutOverrides="Width" FontSize="16" HorizontalAlignment="Left"/>
</Grid>
</Border></Grid>
</Grid>
<!--Beispielcode für die Verwendung von ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Schaltfläche 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Schaltfläche 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="Menüelement 1"/>
<shell:ApplicationBarMenuItem Text="Menüelement 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>-->
</phone:PhoneApplicationPage>

View File

@ -0,0 +1,234 @@
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;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Threading;
using System.Globalization;
namespace GoldShit
{
public partial class MainPage : PhoneApplicationPage, INotifyPropertyChanged
{
private DateTime starttime;
private Thread thread;
private bool _stop = false;
private double moneypersecond;
private AppSettings settings = new AppSettings();
private PoopDataContext PoopDB;
private ObservableCollection<PoopItem> _poopItems;
public ObservableCollection<PoopItem> PoopItems
{
get
{
return _poopItems;
}
set
{
if (_poopItems != value)
{
_poopItems = value;
NotifyPropertyChanged("PoopItems");
}
}
}
// Konstruktor
public MainPage()
{
InitializeComponent();
PoopDB = new PoopDataContext(PoopDataContext.DBConnectionString);
this.DataContext = this;
Init();
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
var poopItemsInDB = from PoopItem poop in PoopDB.PoopItems select poop;
PoopItems = new ObservableCollection<PoopItem>(poopItemsInDB);
base.OnNavigatedTo(e);
LoadStatistics();
}
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
PoopDB.SubmitChanges();
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
private void Init()
{
GetMoneyPerSecond();
}
private void LoadStatistics()
{
this.bstatsall.Items.Clear();
double totmoney = 0;
TimeSpan tottime = new TimeSpan();
foreach (PoopItem p in PoopItems)
{
Grid g = new Grid();
g.Margin = new Thickness(0);
ColumnDefinition cd = new ColumnDefinition();
cd.Width = new GridLength(140);
g.ColumnDefinitions.Add(cd);
cd = new ColumnDefinition();
cd.Width = new GridLength(152);
g.ColumnDefinitions.Add(cd);
cd = new ColumnDefinition();
cd.Width = new GridLength(140);
g.ColumnDefinitions.Add(cd);
ListBoxItem i = new ListBoxItem();
i.Content = p.Start.ToShortDateString();
i.Margin = new Thickness(4, 0, 13, 0);
Grid.SetColumn(i, 0);
g.Children.Add(i);
i = new ListBoxItem();
i.Content = Convert.ToInt32(Math.Floor(p.Stop.Subtract(p.Start).TotalMinutes)).ToString().PadLeft(2, '0') + ":" + p.Stop.Subtract(p.Start).Seconds.ToString().PadLeft(2, '0');
tottime = tottime.Add(p.Stop.Subtract(p.Start));
i.Margin = new Thickness(13, 0, 13, 0);
Grid.SetColumn(i, 1);
g.Children.Add(i);
i = new ListBoxItem();
i.Content = "$" + Math.Round(p.Stop.Subtract(p.Start).TotalSeconds * this.moneypersecond, 2).ToString();
totmoney += p.Stop.Subtract(p.Start).TotalSeconds * this.moneypersecond;
i.Margin = new Thickness(13, 0, 4, 0);
Grid.SetColumn(i, 2);
g.Children.Add(i);
this.bstatsall.Items.Add(g);
}
this.tstattotalmoney.Text = "$" + Math.Round(totmoney, 2).ToString();
this.tstattotaltime.Text = Convert.ToInt32(Math.Floor(tottime.TotalMinutes)).ToString().PadLeft(2, '0') + ":" + tottime.Seconds.ToString().PadLeft(2, '0');
}
private void GetMoneyPerSecond()
{
double m = 0;
if (settings.SettingsHourly)
{
m = settings.SettingsWage / 3600;
}
else if (settings.SettingsSalary)
{
m = settings.SettingsWage / 31556925.261;
}
this.moneypersecond = m;
this.tsettingswage.Text = this.settings.SettingsWage.ToString();
this.tsettingshourly.IsChecked = this.settings.SettingsHourly;
this.tsettingssalary.IsChecked = this.settings.SettingsSalary;
}
private void ApplicationBarIconButton_Click(object sender, EventArgs e)
{
this.bsettings.Visibility = System.Windows.Visibility.Visible;
}
private void tsettingssave_Click(object sender, RoutedEventArgs e)
{
double m = 0;
try
{
this.tsettingswage.Text = this.tsettingswage.Text.Replace(',', '.');
m = Convert.ToDouble(this.tsettingswage.Text, new CultureInfo("en-US"));
} catch(Exception) {
MessageBox.Show("Invaild input");
return;
}
this.settings.SettingsWage = m;
this.settings.SettingsHourly = this.tsettingshourly.IsChecked.Value;
this.settings.SettingsSalary = this.tsettingssalary.IsChecked.Value;
GetMoneyPerSecond();
LoadStatistics();
this.bsettings.Visibility = System.Windows.Visibility.Collapsed;
Canvas.SetZIndex(this.bsettings, 0);
}
private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
{
this.bstat.Visibility = System.Windows.Visibility.Visible;
}
private void tstatclose_Click(object sender, RoutedEventArgs e)
{
this.bstat.Visibility = System.Windows.Visibility.Collapsed;
}
private void bstart_Click(object sender, RoutedEventArgs e)
{
starttime = DateTime.Now;
bstop.IsEnabled = true;
bstart.IsEnabled = false;
this.thread = new Thread(this.TimeRunner);
this._stop = false;
this.thread.Start();
while (!this.thread.IsAlive) ;
}
private void TimeRunner()
{
while (!_stop)
{
DateTime now = DateTime.Now;
TimeSpan d = now.Subtract(starttime);
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
this.ttime.Text = Convert.ToInt32(Math.Floor(d.TotalMinutes)).ToString().PadLeft(2, '0') + ":" + d.Seconds.ToString().PadLeft(2, '0');
this.tmoney.Text = "$" + Math.Round(d.TotalSeconds * this.moneypersecond, 2).ToString();
});
Thread.Sleep(50);
}
}
private void bstop_Click(object sender, RoutedEventArgs e)
{
this._stop = true;
bstop.IsEnabled = false;
bstart.IsEnabled = true;
PoopItem newPoop = new PoopItem { Start = starttime, Stop = DateTime.Now };
PoopItems.Add(newPoop);
PoopDB.PoopItems.InsertOnSubmit(newPoop);
LoadStatistics();
}
private void tstatreset_Click(object sender, RoutedEventArgs e)
{
PoopItems.Clear();
var poopItemsInDB = from PoopItem poop in PoopDB.PoopItems select poop;
PoopDB.PoopItems.DeleteAllOnSubmit(poopItemsInDB);
PoopDB.SubmitChanges();
LoadStatistics();
}
}
public class PoopDataContext : DataContext
{
public static string DBConnectionString = "Data Source=isostore:/Poop.sdf";
public PoopDataContext(string connectionString) : base(connectionString) { }
public Table<PoopItem> PoopItems;
}
}

View File

@ -0,0 +1,98 @@
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.ComponentModel;
using System.Collections.ObjectModel;
namespace GoldShit
{
[Table]
public class PoopItem : INotifyPropertyChanged, INotifyPropertyChanging
{
private int _PoopItemId;
[Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
public int PoopItemId
{
get
{
return _PoopItemId;
}
set
{
if (_PoopItemId != value)
{
NotifyPropertyChanging("PoopItemId");
_PoopItemId = value;
NotifyPropertyChanged("PoopItemId");
}
}
}
private DateTime _start;
[Column]
public DateTime Start
{
get
{
return _start;
}
set
{
if (_start != value)
{
NotifyPropertyChanging("Start");
_start = value;
NotifyPropertyChanged("Start");
}
}
}
private DateTime _stop;
[Column]
public DateTime Stop
{
get
{
return _stop;
}
set
{
if (_stop != value)
{
NotifyPropertyChanging("Stop");
_stop = value;
NotifyPropertyChanged("Stop");
}
}
}
[Column(IsVersion = true)]
private Binary _version;
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
#region INotifyPropertyChanging Members
public event PropertyChangingEventHandler PropertyChanging;
private void NotifyPropertyChanging(string propertyName)
{
if (PropertyChanging != null)
{
PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
}
}
#endregion
}
}

View File

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

View File

@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// Allgemeine Informationen über eine Assembly werden über die folgende
// Attributgruppe gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("GoldShit")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("GoldShit")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID ist für die ID der typelib, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("76a5aed7-0463-48ac-aa3f-7e1bd08cd011")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder die Standardwerte für Revisions- und Buildnummer verwenden
// übernehmen, indem Sie "*" wie folgt verwenden:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("de-DE")]

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
<App xmlns="" ProductID="{2d6d1495-c301-4248-bd8d-3c3080db3772}" Title="GoldShit" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="GoldShit author" Description="Sample description" Publisher="GoldShit">
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_GAMERSERVICES"/>
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
<Capability Name="ID_CAP_IDENTITY_USER"/>
<Capability Name="ID_CAP_LOCATION"/>
<Capability Name="ID_CAP_MEDIALIB"/>
<Capability Name="ID_CAP_MICROPHONE"/>
<Capability Name="ID_CAP_NETWORKING"/>
<Capability Name="ID_CAP_PHONEDIALER"/>
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
<Capability Name="ID_CAP_SENSORS"/>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
<Capability Name="ID_CAP_ISV_CAMERA"/>
<Capability Name="ID_CAP_CONTACTS"/>
<Capability Name="ID_CAP_APPOINTMENTS"/>
</Capabilities>
<Tasks>
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
</Tasks>
<Tokens>
<PrimaryToken TokenID="GoldShitToken" TaskName="_default">
<TemplateType5>
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
<Count>0</Count>
<Title>GoldShit</Title>
</TemplateType5>
</PrimaryToken>
</Tokens>
</App>
</Deployment>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B