Accueil > > > CHRONOMÈTRE EN WPF
CHRONOMÈTRE EN WPF
Information sur la source
Description
Petit Chronomètre réalisé en WPF. En fait c'est la copie conforme de celui que j'ai en vrai! Compilé avec Visual Studio 2008 et réalisé partiellement avec Expression Blend.
Source
- /////////////////////////////////////////////////////////////////////////
- // MyChono.cs
- /////////////////////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Text;
-
- namespace Chronometre
- {
-
- public class MyChrono
- {
- int centiSeconds;
- int seconds;
- int minutes;
- int hours;
- DateTime dateStarted;
- DateTime datePaused;
- bool paused;
- private bool isLaunched; // True when timer launched
-
- public MyChrono()
- {
-
- centiSeconds = 0;
- seconds = 0;
- minutes = 0;
- hours = 0;
- isLaunched = false;
- paused = false;
- }
-
- public void Start()
- {
- isLaunched = true;
-
- // If the chrono has been paused
- if (paused == true)
- {
- // Resume
- TimeSpan t = DateTime.Now.Subtract(datePaused);
- dateStarted = dateStarted.Add(t);
- }
- // Else : not been paused
- else
- dateStarted = DateTime.Now;
-
-
- }
-
- public void Stop()
- {
- isLaunched = false;
- datePaused = DateTime.Now;
- paused = true;
- }
-
- public void Reset()
- {
- isLaunched = false;
- paused = false;
- dateStarted = DateTime.Now;
- datePaused = DateTime.Now;
-
- }
-
- public bool isChronoLaunched
- {
- get //get accessor method
- {
- return isLaunched;
- }
-
- }
-
-
- public override String ToString()
- {
-
-
- DateTime DateNow = DateTime.Now;
- TimeSpan Difference = DateNow - dateStarted;
-
- StringBuilder builder = new StringBuilder(11);
- builder.Append(Difference.Hours.ToString("d2"));
- builder.Append(":");
- builder.Append(Difference.Minutes.ToString("d2"));
- builder.Append(":");
- builder.Append(Difference.Seconds.ToString("d2"));
- builder.Append(":");
- builder.Append((Difference.Milliseconds.ToString("d2")).Substring(0,2));
-
- return builder.ToString();
- }
-
- public String Now()
- {
- DateTime dateNow = DateTime.Now;
- StringBuilder builder = new StringBuilder(8);
- builder.Append(dateNow.Hour.ToString("d2"));
- builder.Append(":");
- builder.Append(dateNow.Minute.ToString("d2"));
- builder.Append(":");
- builder.Append(dateNow.Second.ToString("d2"));
-
- return builder.ToString();
- }
- }
- }
- /////////////////////////////////////////////////////////////////////////
- // Window1.xaml.cs
- /////////////////////////////////////////////////////////////////////////
-
-
- using System;
- using System.IO;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Navigation;
- using System.Windows.Threading;
-
- namespace Chronometre
- {
- public partial class Window1
- {
- enum Modes { timer, clock }
- int mode; // Mode
- DispatcherTimer dispatcherTimer;
- DispatcherTimer clockTimer;
- MyChrono chrono;
-
- public Window1()
- {
- this.InitializeComponent();
-
- // Insert code required on object creation below this point.
- mode = (int)Modes.timer;
-
- // Setup the timer
- dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
- dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
- dispatcherTimer.Interval = new TimeSpan(0,0,0,0,10);
-
- clockTimer = new System.Windows.Threading.DispatcherTimer();
- clockTimer.Tick += new EventHandler(clockTimer_Tick);
- clockTimer.Interval = new TimeSpan(0, 0, 1);
- clockTimer.Start();
-
-
- chrono = new MyChrono();
-
- }
-
- private void clockTimer_Tick(object sender, EventArgs e)
- {
- lblClockDisplay.Content = chrono.Now();
- }
-
- // When the timer tick
- private void dispatcherTimer_Tick(object sender, EventArgs e)
- {
- lblTime.Content = chrono.ToString();
-
-
-
-
-
-
- }
-
-
- // When the mode button is clicked
- private void btnMode_Click(object sender, RoutedEventArgs e)
- {
- // Set all the mode's labels ton unvisible
- lblTimer.Visibility = Visibility.Hidden;
- lblPeacer.Visibility = Visibility.Hidden;
- lblClock.Visibility = Visibility.Hidden;
-
-
-
- lblTime.Visibility = Visibility.Hidden;
- lblPeacerDisplay.Visibility = Visibility.Hidden;
- lblClockDisplay.Visibility = Visibility.Hidden;
-
- // Increment
- mode++;
- mode = mode%2;
-
- // Set if the labels are visible or not
- Console.WriteLine("le mode : " + mode);
- if (mode == (int)Modes.timer)
- {
- lblTimer.Visibility = Visibility.Visible;
- lblTime.Visibility = Visibility.Visible;
- }
- /*else if (mode == (int)Modes.peacer)
- {
- lblPeacer.Visibility = Visibility.Visible;
- lblPeacerDisplay.Visibility = Visibility.Visible;
- }*/
- else if (mode == (int)Modes.clock)
- {
- lblClock.Visibility = Visibility.Visible;
- lblClockDisplay.Visibility = Visibility.Visible;
- }
- }
-
- private void BtnClose_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
-
- private void BtnStartStop_Click(object sender, RoutedEventArgs e)
- {
- if (mode == (int)Modes.timer)
- {
- if (!chrono.isChronoLaunched)
- {
-
- chrono.Start();
- dispatcherTimer.Start();
-
- }
- else
- {
- chrono.Stop();
- dispatcherTimer.Stop();
-
-
- }
- }
-
- }
-
- private void BtnReset_Click(object sender, RoutedEventArgs e)
- {
- if (mode == (int)Modes.timer)
- {
- chrono.Stop();
- chrono.Reset();
- dispatcherTimer.Stop();
- lblTime.Content = "00:00:00:00";
- }
- }
-
- private void DragChrono(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- this.DragMove();
- }
-
-
-
-
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////////////////
- // Window1.xaml
- ////////////////////////////////////////////////////////////////////////////////////////////<Window
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- x:Class="Chronometre.Window1"
- x:Name="Window"
- Title="Chronomètre"
- Width="640" Height="480" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}">
-
- <Window.Resources>
- <Storyboard x:Key="OnClick1"/>
- <Style x:Key="ButtonFocusVisual">
- <Setter Property="Control.Template">
- <Setter.Value>
- <ControlTemplate>
- <Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2"/>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
- <GradientStop Color="#F3F3F3" Offset="0"/>
- <GradientStop Color="#EBEBEB" Offset="0.5"/>
- <GradientStop Color="#DDDDDD" Offset="0.5"/>
- <GradientStop Color="#CDCDCD" Offset="1"/>
- </LinearGradientBrush>
- <SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
- <Style x:Key="ButtonChrono" TargetType="{x:Type Button}">
- <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
- <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
- <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- <Setter Property="HorizontalContentAlignment" Value="Center"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Padding" Value="1"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <ControlTemplate.Resources>
- <Storyboard x:Key="OnClick1">
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
- <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE38E19"/>
- <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="sc#1, 0.283148736, 0.768151164, 0.009721218"/>
- <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFE38E19"/>
- </ColorAnimationUsingKeyFrames>
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
- <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFD06C"/>
- <SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="sc#1, 0.806952238, 0.9559733, 0.610495567"/>
- <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFD06C"/>
- </ColorAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
- <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="4"/>
- <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="1x" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="ellipse">
- <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="ellipse">
- <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
- <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="clignote">
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
- <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
- <SplineColorKeyFrame KeyTime="00:00:01" Value="#FF39FF00"/>
- <SplineColorKeyFrame KeyTime="00:00:02" Value="#FF000000"/>
- </ColorAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.StrokeThickness)">
- <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
- <SplineDoubleKeyFrame KeyTime="00:00:01" Value="2"/>
- <SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Grid Width="67.5" Height="44">
- <Ellipse RenderTransformOrigin="0.5,0.5" Stroke="#FF000000" Margin="0,0,0,0" x:Name="ellipse">
- <Ellipse.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="0"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </Ellipse.RenderTransform>
- <Ellipse.Fill>
- <RadialGradientBrush>
- <GradientStop Color="#FFFFD06C" Offset="0"/>
- <GradientStop Color="#FFE38E19" Offset="1"/>
- </RadialGradientBrush>
- </Ellipse.Fill>
- </Ellipse>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard x:Name="clignote_BeginStoryboard" Storyboard="{StaticResource clignote}"/>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <StopStoryboard BeginStoryboardName="clignote_BeginStoryboard"/>
- </Trigger.ExitActions>
- </Trigger>
- <EventTrigger RoutedEvent="FrameworkElement.Loaded"/>
- <Trigger Property="IsKeyboardFocused" Value="true"/>
- <Trigger Property="ToggleButton.IsChecked" Value="true"/>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="#ADADAD"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard x:Name="OnClick1_BeginStoryboard" Storyboard="{StaticResource OnClick1}"/>
- </Trigger.EnterActions>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ModeButton" TargetType="{x:Type Button}">
- <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
- <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
- <Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
- <Setter Property="HorizontalContentAlignment" Value="Center"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Padding" Value="1"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <ControlTemplate.Resources>
- <Storyboard x:Key="Timeline1">
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
- <SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
- <SplineColorKeyFrame KeyTime="00:00:01" Value="#FF39FF00"/>
- <SplineColorKeyFrame KeyTime="00:00:02" Value="#FF000000"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnClick">
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
- <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE38E19"/>
- <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FF91E319"/>
- <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFE38E19"/>
- </ColorAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
- <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
- <SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
- <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
- <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
- </DoubleAnimationUsingKeyFrames>
- <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
- <SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFD06C"/>
- <SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FFFFF76C"/>
- <SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFD06C"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Grid>
- <Path Stretch="Fill" Stroke="#FF000000" Margin="1.768,-2.49,2.261,-0.5" x:Name="path" VerticalAlignment="Stretch" Height="Auto" Data="M7.667056,-0.16723592 L54.331773,-0.16778772 C54.331773,-0.16778772 57.331558,0.4993614 63.331674,-1.8343669 69.451225,-4.2145487 59.332635,21.171333 53.999371,23.838667 48.666107,26.506 34.66602,27.1732 28.666148,23.17216 28.666148,23.17216 14.33354,16.170131 6.333711,9.1683588 6.333711,9.1683588 1.6667451,7.1679536 2.3333975,2.8335234 3.00005,-1.5009067 7.667056,-0.16723592 7.667056,-0.16723592 z">
- <Path.Fill>
- <RadialGradientBrush>
- <GradientStop Color="#FFFFD06C" Offset="0"/>
- <GradientStop Color="#FFE38E19" Offset="1"/>
- </RadialGradientBrush>
- </Path.Fill>
- </Path>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard x:Name="Timeline1_BeginStoryboard" Storyboard="{StaticResource Timeline1}"/>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <StopStoryboard BeginStoryboardName="Timeline1_BeginStoryboard"/>
- </Trigger.ExitActions>
- </Trigger>
- <Trigger Property="IsKeyboardFocused" Value="true"/>
- <Trigger Property="ToggleButton.IsChecked" Value="true"/>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="#ADADAD"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard x:Name="OnClick_BeginStoryboard" Storyboard="{StaticResource OnClick}"/>
- </Trigger.EnterActions>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <FontFamily x:Key="FontChrono">Humnst777 Lt BT</FontFamily>
- </Window.Resources>
- <Window.Triggers>
- <EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnStop"/>
- <EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnReset"/>
- <EventTrigger RoutedEvent="ButtonBase.Click" SourceName="btnMode"/>
- <EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnClose"/>
- </Window.Triggers>
- <Grid>
- <Button RenderTransformOrigin="0.5,0.5" x:Name="BtnStop" Style="{DynamicResource ButtonChrono}" Height="43.305" Content="Button" HorizontalAlignment="Right" Margin="0,59.705,169.111,0" VerticalAlignment="Top" Width="72.451" Click="BtnStartStop_Click">
- <Button.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="44.745"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </Button.RenderTransform>
- </Button>
- <Button RenderTransformOrigin="0.5,0.5" x:Name="BtnClose" Style="{DynamicResource ButtonChrono}" Height="43.305" Content="Button" Margin="274.438,19.038,293.111,0" VerticalAlignment="Top" Click="BtnClose_Click">
- <Button.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="0"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </Button.RenderTransform>
- </Button>
- <Button RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="146.437,61.705,0,0" x:Name="BtnReset" Style="{DynamicResource ButtonChrono}" VerticalAlignment="Top" Width="72.451" Height="43.305" Content="Button" Click="BtnReset_Click">
- <Button.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="-46.887"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </Button.RenderTransform>
- </Button>
- <Path Stretch="Fill" Stroke="#FF000000" Margin="134.797,36.574,156.323,8" x:Name="Coque" Data="F1 M171.953,376.332 C161.04538,376.332 152.203,385.17438 152.203,396.082 152.203,406.98962 161.04538,415.832 171.953,415.832 182.86063,415.832 191.703,406.98962 191.703,396.082 191.703,385.17438 182.86063,376.332 171.953,376.332 z M160.8188,0.51317179 C172.70158,0.65379781 178.703,0.83199362 178.703,0.83199372 178.891,0.81008102 289.82605,-10.859599 330.06485,89.443733 369.20163,186.99997 333.44241,336.59485 333.44241,336.59485 323.12469,362.75375 305.88052,431.35153 180.58833,434.17569 33.588947,444.67569 15.349137,325.70868 15.349136,325.70868 15.286747,325.48871 -20.762596,198.27933 19.702114,90.372581 50.076893,9.372551 125.17045,0.091297753 160.8188,0.51317179 z">
- <Path.Fill>
- <RadialGradientBrush>
- <GradientStop Color="#FF827A7A" Offset="1"/>
- <GradientStop Color="#FFF0F0F0" Offset="0.024"/>
- </RadialGradientBrush>
- </Path.Fill>
- </Path>
- <Path Stretch="Fill" Stroke="#FF000000" Margin="164.582,73.99,185.867,176.5" x:Name="TourGeonaute" Data="M220.5,300 L406.5,301.5 C406.5,301.5 444.00038,300 444.00038,265.5 444.00038,231 448.5,219 433.5,159 418.5,99 307.31189,106.98749 307.31189,106.98749 307.31189,106.98749 214.49999,99.000432 194.99996,151.50032 175.49992,204.00021 182.99975,267 182.99975,267 182.99975,267 187.50008,300 220.5,300 z">
- <Path.Fill>
- <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
- <GradientStop Color="#FFECD27F" Offset="0.986"/>
- <GradientStop Color="#FFE38B14" Offset="0"/>
- </LinearGradientBrush>
- </Path.Fill>
- </Path>
- <Button HorizontalAlignment="Right" Margin="0,0,207.667,146.5" Style="{DynamicResource ModeButton}" VerticalAlignment="Bottom" Width="68" Height="26" Content="Button" x:Name="btnMode" Click="btnMode_Click" />
- <TextBlock RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="163.414,79.927,0,0" x:Name="txtReset" VerticalAlignment="Top" Width="57" Height="21.53" Text="reset" TextAlignment="Center" TextWrapping="Wrap">
- <TextBlock.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="-48.444"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </TextBlock.RenderTransform>
- </TextBlock>
- <TextBlock RenderTransformOrigin="0.5,0.5" x:Name="txtClose" Height="21.53" Text="close" TextAlignment="Center" TextWrapping="Wrap" Margin="281.414,40.927,301.586,0" VerticalAlignment="Top">
- <TextBlock.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="0"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </TextBlock.RenderTransform>
- </TextBlock>
- <TextBlock RenderTransformOrigin="0.5,0.5" x:Name="txtStart" Width="57" Height="21.53" Text="start | stop" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Right" Margin="0,79.927,188.586,0" VerticalAlignment="Top">
- <TextBlock.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="44.312"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </TextBlock.RenderTransform>
- </TextBlock>
- <Rectangle Fill="#FFFFFFFF" Stroke="#FF000000" RadiusX="6.5" RadiusY="6.5" Margin="194,139,220,223"/>
- <Grid Margin="194,139,220,223">
- <Label Margin="8,8,8,16" Content="00:00:00:00" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblTime" />
- <Label Margin="8,8,8,16" Content="30" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblPeacerDisplay" Visibility="Hidden" />
- <Label Margin="8,8,8,16" Content="00:00:00" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblClockDisplay" Visibility="Hidden" />
- <Label HorizontalAlignment="Left" Margin="34.664,0,0,-5.332" x:Name="lblTimer" VerticalAlignment="Bottom" Width="37.333" Height="25.334" Content="TIMER" FontFamily="{DynamicResource FontChrono}" FontSize="8"/>
- <Label x:Name="lblPeacer" Height="25.334" Content="PEACER" FontFamily="{DynamicResource FontChrono}" FontSize="8" Visibility="Hidden" Margin="89.997,0,98.67,-5.332" VerticalAlignment="Bottom"/>
- <Label x:Name="lblClock" Height="25.334" Content="CLOCK" FontFamily="{DynamicResource FontChrono}" FontSize="8" Visibility="Hidden" HorizontalAlignment="Right" Margin="0,0,40.004,-5.332" VerticalAlignment="Bottom" Width="37.333"/>
- </Grid>
- <TextBlock RenderTransformOrigin="0.5,0.5" x:Name="lblMode" Text="mode" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Right" Margin="0,0,240.667,172.5" VerticalAlignment="Bottom" Width="35" Height="21.53" Foreground="#FF615C5C">
- <TextBlock.RenderTransform>
- <TransformGroup>
- <ScaleTransform ScaleX="1" ScaleY="1"/>
- <SkewTransform AngleX="0" AngleY="0"/>
- <RotateTransform Angle="0"/>
- <TranslateTransform X="0" Y="0"/>
- </TransformGroup>
- </TextBlock.RenderTransform>
- </TextBlock>
- <Path Fill="#FF827A7A" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="0,0,231.833,180.833" VerticalAlignment="Bottom" Width="7.334" Height="6" Data="M401.33333,294 L407.66701,293.66667 404.66684,298.67148 z"/>
- <Label Margin="193.998,92,226.002,0" VerticalAlignment="Top" Height="43" Content="Chronomètre" FontFamily="{DynamicResource FontChrono}" FontSize="24" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
- <Grid Margin="248.666,0,273.333,84.667" VerticalAlignment="Bottom" Height="43.333">
- <Label HorizontalAlignment="Left" Margin="8,15.333,0,8" x:Name="lblModele" Width="27.334" Content="mtd" FontFamily="{DynamicResource FontChrono}" FontSize="10"/>
- <Label Margin="28.667,14,32.001,1.333" x:Name="lblModele2" Content="5 O O" FontFamily="{DynamicResource FontChrono}" FontSize="18"/>
- <Ellipse Fill="{x:Null}" Stroke="#FFE38E19" StrokeThickness="3" Margin="45.334,20,52.667,3.333" x:Name="ellPetitChrono"/>
- <Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" HorizontalAlignment="Left" Margin="44.498,21.499,0,17.667" Width="4.333"/>
- <Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" Width="4.333" HorizontalAlignment="Left" Margin="52.831,17.499,0,0" VerticalAlignment="Top" Height="4.167"/>
- <Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" HorizontalAlignment="Right" Margin="0,21.499,52.504,17.667" Width="4.333"/>
- </Grid>
- </Grid>
- </Window>
/////////////////////////////////////////////////////////////////////////
// MyChono.cs
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
namespace Chronometre
{
public class MyChrono
{
int centiSeconds;
int seconds;
int minutes;
int hours;
DateTime dateStarted;
DateTime datePaused;
bool paused;
private bool isLaunched; // True when timer launched
public MyChrono()
{
centiSeconds = 0;
seconds = 0;
minutes = 0;
hours = 0;
isLaunched = false;
paused = false;
}
public void Start()
{
isLaunched = true;
// If the chrono has been paused
if (paused == true)
{
// Resume
TimeSpan t = DateTime.Now.Subtract(datePaused);
dateStarted = dateStarted.Add(t);
}
// Else : not been paused
else
dateStarted = DateTime.Now;
}
public void Stop()
{
isLaunched = false;
datePaused = DateTime.Now;
paused = true;
}
public void Reset()
{
isLaunched = false;
paused = false;
dateStarted = DateTime.Now;
datePaused = DateTime.Now;
}
public bool isChronoLaunched
{
get //get accessor method
{
return isLaunched;
}
}
public override String ToString()
{
DateTime DateNow = DateTime.Now;
TimeSpan Difference = DateNow - dateStarted;
StringBuilder builder = new StringBuilder(11);
builder.Append(Difference.Hours.ToString("d2"));
builder.Append(":");
builder.Append(Difference.Minutes.ToString("d2"));
builder.Append(":");
builder.Append(Difference.Seconds.ToString("d2"));
builder.Append(":");
builder.Append((Difference.Milliseconds.ToString("d2")).Substring(0,2));
return builder.ToString();
}
public String Now()
{
DateTime dateNow = DateTime.Now;
StringBuilder builder = new StringBuilder(8);
builder.Append(dateNow.Hour.ToString("d2"));
builder.Append(":");
builder.Append(dateNow.Minute.ToString("d2"));
builder.Append(":");
builder.Append(dateNow.Second.ToString("d2"));
return builder.ToString();
}
}
}
/////////////////////////////////////////////////////////////////////////
// Window1.xaml.cs
/////////////////////////////////////////////////////////////////////////
using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Threading;
namespace Chronometre
{
public partial class Window1
{
enum Modes { timer, clock }
int mode; // Mode
DispatcherTimer dispatcherTimer;
DispatcherTimer clockTimer;
MyChrono chrono;
public Window1()
{
this.InitializeComponent();
// Insert code required on object creation below this point.
mode = (int)Modes.timer;
// Setup the timer
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0,0,0,0,10);
clockTimer = new System.Windows.Threading.DispatcherTimer();
clockTimer.Tick += new EventHandler(clockTimer_Tick);
clockTimer.Interval = new TimeSpan(0, 0, 1);
clockTimer.Start();
chrono = new MyChrono();
}
private void clockTimer_Tick(object sender, EventArgs e)
{
lblClockDisplay.Content = chrono.Now();
}
// When the timer tick
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
lblTime.Content = chrono.ToString();
}
// When the mode button is clicked
private void btnMode_Click(object sender, RoutedEventArgs e)
{
// Set all the mode's labels ton unvisible
lblTimer.Visibility = Visibility.Hidden;
lblPeacer.Visibility = Visibility.Hidden;
lblClock.Visibility = Visibility.Hidden;
lblTime.Visibility = Visibility.Hidden;
lblPeacerDisplay.Visibility = Visibility.Hidden;
lblClockDisplay.Visibility = Visibility.Hidden;
// Increment
mode++;
mode = mode%2;
// Set if the labels are visible or not
Console.WriteLine("le mode : " + mode);
if (mode == (int)Modes.timer)
{
lblTimer.Visibility = Visibility.Visible;
lblTime.Visibility = Visibility.Visible;
}
/*else if (mode == (int)Modes.peacer)
{
lblPeacer.Visibility = Visibility.Visible;
lblPeacerDisplay.Visibility = Visibility.Visible;
}*/
else if (mode == (int)Modes.clock)
{
lblClock.Visibility = Visibility.Visible;
lblClockDisplay.Visibility = Visibility.Visible;
}
}
private void BtnClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void BtnStartStop_Click(object sender, RoutedEventArgs e)
{
if (mode == (int)Modes.timer)
{
if (!chrono.isChronoLaunched)
{
chrono.Start();
dispatcherTimer.Start();
}
else
{
chrono.Stop();
dispatcherTimer.Stop();
}
}
}
private void BtnReset_Click(object sender, RoutedEventArgs e)
{
if (mode == (int)Modes.timer)
{
chrono.Stop();
chrono.Reset();
dispatcherTimer.Stop();
lblTime.Content = "00:00:00:00";
}
}
private void DragChrono(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
this.DragMove();
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////
// Window1.xaml
////////////////////////////////////////////////////////////////////////////////////////////<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Chronometre.Window1"
x:Name="Window"
Title="Chronomètre"
Width="640" Height="480" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}">
<Window.Resources>
<Storyboard x:Key="OnClick1"/>
<Style x:Key="ButtonFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#F3F3F3" Offset="0"/>
<GradientStop Color="#EBEBEB" Offset="0.5"/>
<GradientStop Color="#DDDDDD" Offset="0.5"/>
<GradientStop Color="#CDCDCD" Offset="1"/>
</LinearGradientBrush>
<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
<Style x:Key="ButtonChrono" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<ControlTemplate.Resources>
<Storyboard x:Key="OnClick1">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE38E19"/>
<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="sc#1, 0.283148736, 0.768151164, 0.009721218"/>
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFE38E19"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFD06C"/>
<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="sc#1, 0.806952238, 0.9559733, 0.610495567"/>
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFD06C"/>
</ColorAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="4"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="1x" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="ellipse">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="ellipse">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="clignote">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FF39FF00"/>
<SplineColorKeyFrame KeyTime="00:00:02" Value="#FF000000"/>
</ColorAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.StrokeThickness)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="2"/>
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid Width="67.5" Height="44">
<Ellipse RenderTransformOrigin="0.5,0.5" Stroke="#FF000000" Margin="0,0,0,0" x:Name="ellipse">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#FFFFD06C" Offset="0"/>
<GradientStop Color="#FFE38E19" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="clignote_BeginStoryboard" Storyboard="{StaticResource clignote}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="clignote_BeginStoryboard"/>
</Trigger.ExitActions>
</Trigger>
<EventTrigger RoutedEvent="FrameworkElement.Loaded"/>
<Trigger Property="IsKeyboardFocused" Value="true"/>
<Trigger Property="ToggleButton.IsChecked" Value="true"/>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="OnClick1_BeginStoryboard" Storyboard="{StaticResource OnClick1}"/>
</Trigger.EnterActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ModeButton" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<ControlTemplate.Resources>
<Storyboard x:Key="Timeline1">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FF39FF00"/>
<SplineColorKeyFrame KeyTime="00:00:02" Value="#FF000000"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="OnClick">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE38E19"/>
<SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FF91E319"/>
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFE38E19"/>
</ColorAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFD06C"/>
<SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FFFFF76C"/>
<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFD06C"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid>
<Path Stretch="Fill" Stroke="#FF000000" Margin="1.768,-2.49,2.261,-0.5" x:Name="path" VerticalAlignment="Stretch" Height="Auto" Data="M7.667056,-0.16723592 L54.331773,-0.16778772 C54.331773,-0.16778772 57.331558,0.4993614 63.331674,-1.8343669 69.451225,-4.2145487 59.332635,21.171333 53.999371,23.838667 48.666107,26.506 34.66602,27.1732 28.666148,23.17216 28.666148,23.17216 14.33354,16.170131 6.333711,9.1683588 6.333711,9.1683588 1.6667451,7.1679536 2.3333975,2.8335234 3.00005,-1.5009067 7.667056,-0.16723592 7.667056,-0.16723592 z">
<Path.Fill>
<RadialGradientBrush>
<GradientStop Color="#FFFFD06C" Offset="0"/>
<GradientStop Color="#FFE38E19" Offset="1"/>
</RadialGradientBrush>
</Path.Fill>
</Path>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="Timeline1_BeginStoryboard" Storyboard="{StaticResource Timeline1}"/>
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="Timeline1_BeginStoryboard"/>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true"/>
<Trigger Property="ToggleButton.IsChecked" Value="true"/>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#ADADAD"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="OnClick_BeginStoryboard" Storyboard="{StaticResource OnClick}"/>
</Trigger.EnterActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<FontFamily x:Key="FontChrono">Humnst777 Lt BT</FontFamily>
</Window.Resources>
<Window.Triggers>
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnStop"/>
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnReset"/>
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="btnMode"/>
<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnClose"/>
</Window.Triggers>
<Grid>
<Button RenderTransformOrigin="0.5,0.5" x:Name="BtnStop" Style="{DynamicResource ButtonChrono}" Height="43.305" Content="Button" HorizontalAlignment="Right" Margin="0,59.705,169.111,0" VerticalAlignment="Top" Width="72.451" Click="BtnStartStop_Click">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="44.745"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button RenderTransformOrigin="0.5,0.5" x:Name="BtnClose" Style="{DynamicResource ButtonChrono}" Height="43.305" Content="Button" Margin="274.438,19.038,293.111,0" VerticalAlignment="Top" Click="BtnClose_Click">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Button.RenderTransform>
</Button>
<Button RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="146.437,61.705,0,0" x:Name="BtnReset" Style="{DynamicResource ButtonChrono}" VerticalAlignment="Top" Width="72.451" Height="43.305" Content="Button" Click="BtnReset_Click">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="-46.887"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Button.RenderTransform>
</Button>
<Path Stretch="Fill" Stroke="#FF000000" Margin="134.797,36.574,156.323,8" x:Name="Coque" Data="F1 M171.953,376.332 C161.04538,376.332 152.203,385.17438 152.203,396.082 152.203,406.98962 161.04538,415.832 171.953,415.832 182.86063,415.832 191.703,406.98962 191.703,396.082 191.703,385.17438 182.86063,376.332 171.953,376.332 z M160.8188,0.51317179 C172.70158,0.65379781 178.703,0.83199362 178.703,0.83199372 178.891,0.81008102 289.82605,-10.859599 330.06485,89.443733 369.20163,186.99997 333.44241,336.59485 333.44241,336.59485 323.12469,362.75375 305.88052,431.35153 180.58833,434.17569 33.588947,444.67569 15.349137,325.70868 15.349136,325.70868 15.286747,325.48871 -20.762596,198.27933 19.702114,90.372581 50.076893,9.372551 125.17045,0.091297753 160.8188,0.51317179 z">
<Path.Fill>
<RadialGradientBrush>
<GradientStop Color="#FF827A7A" Offset="1"/>
<GradientStop Color="#FFF0F0F0" Offset="0.024"/>
</RadialGradientBrush>
</Path.Fill>
</Path>
<Path Stretch="Fill" Stroke="#FF000000" Margin="164.582,73.99,185.867,176.5" x:Name="TourGeonaute" Data="M220.5,300 L406.5,301.5 C406.5,301.5 444.00038,300 444.00038,265.5 444.00038,231 448.5,219 433.5,159 418.5,99 307.31189,106.98749 307.31189,106.98749 307.31189,106.98749 214.49999,99.000432 194.99996,151.50032 175.49992,204.00021 182.99975,267 182.99975,267 182.99975,267 187.50008,300 220.5,300 z">
<Path.Fill>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="#FFECD27F" Offset="0.986"/>
<GradientStop Color="#FFE38B14" Offset="0"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
<Button HorizontalAlignment="Right" Margin="0,0,207.667,146.5" Style="{DynamicResource ModeButton}" VerticalAlignment="Bottom" Width="68" Height="26" Content="Button" x:Name="btnMode" Click="btnMode_Click" />
<TextBlock RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="163.414,79.927,0,0" x:Name="txtReset" VerticalAlignment="Top" Width="57" Height="21.53" Text="reset" TextAlignment="Center" TextWrapping="Wrap">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="-48.444"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock RenderTransformOrigin="0.5,0.5" x:Name="txtClose" Height="21.53" Text="close" TextAlignment="Center" TextWrapping="Wrap" Margin="281.414,40.927,301.586,0" VerticalAlignment="Top">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
<TextBlock RenderTransformOrigin="0.5,0.5" x:Name="txtStart" Width="57" Height="21.53" Text="start | stop" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Right" Margin="0,79.927,188.586,0" VerticalAlignment="Top">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="44.312"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
<Rectangle Fill="#FFFFFFFF" Stroke="#FF000000" RadiusX="6.5" RadiusY="6.5" Margin="194,139,220,223"/>
<Grid Margin="194,139,220,223">
<Label Margin="8,8,8,16" Content="00:00:00:00" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblTime" />
<Label Margin="8,8,8,16" Content="30" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblPeacerDisplay" Visibility="Hidden" />
<Label Margin="8,8,8,16" Content="00:00:00" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblClockDisplay" Visibility="Hidden" />
<Label HorizontalAlignment="Left" Margin="34.664,0,0,-5.332" x:Name="lblTimer" VerticalAlignment="Bottom" Width="37.333" Height="25.334" Content="TIMER" FontFamily="{DynamicResource FontChrono}" FontSize="8"/>
<Label x:Name="lblPeacer" Height="25.334" Content="PEACER" FontFamily="{DynamicResource FontChrono}" FontSize="8" Visibility="Hidden" Margin="89.997,0,98.67,-5.332" VerticalAlignment="Bottom"/>
<Label x:Name="lblClock" Height="25.334" Content="CLOCK" FontFamily="{DynamicResource FontChrono}" FontSize="8" Visibility="Hidden" HorizontalAlignment="Right" Margin="0,0,40.004,-5.332" VerticalAlignment="Bottom" Width="37.333"/>
</Grid>
<TextBlock RenderTransformOrigin="0.5,0.5" x:Name="lblMode" Text="mode" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Right" Margin="0,0,240.667,172.5" VerticalAlignment="Bottom" Width="35" Height="21.53" Foreground="#FF615C5C">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
<Path Fill="#FF827A7A" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="0,0,231.833,180.833" VerticalAlignment="Bottom" Width="7.334" Height="6" Data="M401.33333,294 L407.66701,293.66667 404.66684,298.67148 z"/>
<Label Margin="193.998,92,226.002,0" VerticalAlignment="Top" Height="43" Content="Chronomètre" FontFamily="{DynamicResource FontChrono}" FontSize="24" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
<Grid Margin="248.666,0,273.333,84.667" VerticalAlignment="Bottom" Height="43.333">
<Label HorizontalAlignment="Left" Margin="8,15.333,0,8" x:Name="lblModele" Width="27.334" Content="mtd" FontFamily="{DynamicResource FontChrono}" FontSize="10"/>
<Label Margin="28.667,14,32.001,1.333" x:Name="lblModele2" Content="5 O O" FontFamily="{DynamicResource FontChrono}" FontSize="18"/>
<Ellipse Fill="{x:Null}" Stroke="#FFE38E19" StrokeThickness="3" Margin="45.334,20,52.667,3.333" x:Name="ellPetitChrono"/>
<Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" HorizontalAlignment="Left" Margin="44.498,21.499,0,17.667" Width="4.333"/>
<Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" Width="4.333" HorizontalAlignment="Left" Margin="52.831,17.499,0,0" VerticalAlignment="Top" Height="4.167"/>
<Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" HorizontalAlignment="Right" Margin="0,21.499,52.504,17.667" Width="4.333"/>
</Grid>
</Grid>
</Window>
Conclusion
Le bouton fermer se situe en haut du Chronomètre
Historique
- 30 mai 2008 15:52:15 :
- Ajout du déplacement (Drag)
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
problème du chargement de la première forme WPF [ par ralf9 ]
Salut ! j'aimerais commencer a faire du WPF en utilisant C# et Expression Blend 2 ! et déjà ça me décourage vraiment ! Voila, a chaque fois que je dé
[Xaml]WPF ItemsSources et ItemTemplate without ListBox [ par Theridion1 ]
Bonjour,Pour illustrer mon soucis je part sur le Sample suivant :http://msdn.microsoft.com/en-us/library/system.windows.documents.tablecell.aspx <!
nom du jour de la semaine datetime format [ par olibara ]
BonjourPour construire une chaine date "20081111" a partir d"un datetime, je faisDateTime.Now.ToString("yyyyMMdd");Mais comment faire si je veux avoir
Problème lors de la détection de mes Addin-in (System.Addin) [ par teddyalbina ]
Bonjour j'ai un soucis avec System.Addin qui ne détecte pas mes addins. Cela fait plusieurs jours que je cherche une solution mais je sèche donc voici
Probème de détection AddIn incompréhensible [ par teddyalbina ]
Bonjour,J'ai posté il a plusieurs jours un message concernant mes problèmes avec System.AddIn. Après avoir retourné et lu 50 fois mon code je n'ai rie
Probléme de Date [ par floflo69290 ]
Bonjour,Je viens de reprendre une application en C# et j'ai un soucis :Je récupére les valeurs du jour, mois et année avec des string et je voudrais r
Drag and Drop entre deux treeview WPF c# [ par onizuka29 ]
Bonjour, je voudrais faire une application WPF en C# avec deux treeviews, un contenant l'explorateur du poste et l'autre celui du serveur.Le problème
DATETIME à null [ par Fo0Zie ]
Bonjour à tous,J'ai une txtBoxDate, qui contient une date qui peut-être null.J'utilise SQL Server 2005 pour ma BdD, mon date dans ma table est au form
WPF - value dans un combobox [ par wally88 ]
Bonjour, Comment ajouter les valeurs dans une collection d'item d'un combobox en wpf.Avec un dataset j'y arrive, mais en "dur" on ne peut pas ?Merci.
Caroussel3D en WPF bindé avec une liste d'objet [ par poiuytrez3 ]
Bonjour,Je cherche à faire un carroussel 3D en WPF, ou plutôt utiliser un carroussel existant et le binder avec une list d'objet.J'ai beaucoup de mal,
|
Derniers Blogs
UNE JOLIE-HORLOGE ET PAS QU'UN PEU !UNE JOLIE-HORLOGE ET PAS QU'UN PEU ! par neodante
Pour les possesseurs d'iPhone, ça y est Bijin Tokei - qui se traduit littéralement en Français par " Jolie Horloge " - est arrivé et GRATUITEMENT s'il vous plaît ! Après la version Tokyo, Hokkaido, night club, racing, Gal, "pour les mademoiselles'", . voi...
Cliquez pour lire la suite de l'article par neodante TECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICESTECHDAYS PARIS 2010 : CONNECTEZ VOS DONNéES à SHAREPOINT 2010 AVEC LES BUSINESS CONNECTIVITY SERVICES par ROMELARD Fabrice
Animé par: Gaetan Bouveret et Julien Chomarat Business Connectivity Services (BCS) est dans SharePoint 2010 la version 2 de Business Data Catalog (BDC dans SharePoint 2007). Il s'agit de la solution permettant de visualiser des données provenan...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE[DIVERS] SUIVRE VOS SéRIES PRéFéRéS SUR LA TOILE par orion
Comme de nombreux geek, je suis un grand amateur de série TV et je rate régulièrement des épisodes de mes séries préférés. Une solution s'offre à vous avec ce merveilleux site : Tv Gorge - www.tvgorge.com Moteur de recherche à l'appui, vous pouvez ...
Cliquez pour lire la suite de l'article par orion TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
|