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
WORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBEWORKFLOW FOUNDATION 3 A UN PIED DANS LA TOMBE par JeremyJeanson
Depuis déjà un an, je conseille vivement les utilisateurs de Workflow Foundation 3 à migrer vers la version 4. L'information qui va suivre ne devrait donc pas trop prendre au dépourvu les personnes qui m'ont suivi. Je profite de ce poste, pour faire le re...
Cliquez pour lire la suite de l'article par JeremyJeanson TECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PCTECHDAYS PARIS 2012 : NOUVELLES TENDANCES DU POSTE DE TRAVAIL - BRING YOUR OWN PC par ROMELARD Fabrice
Speakers: Thierry Rapatout, Antoine Petit et Xavier Trebbia Cette session entre dans le cadre des RDV Décideurs des TechDays 2012, elle est liée à la consumérisation de l'IT et la mise en place du "DeskTop as a Service" dans de plus en ...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLETECHDAYS PARIS 2012 : SYSTEM CENTER SERVICE MANAGER 2012 VUE D'ENSEMBLE par ROMELARD Fabrice
Speakers: Julien Marechal, Gautier Confiant, Sébastien MEYER La session débute par le positionnement de la solution System Center par rapport aux concepts d'organisation ITIL. Le portail du catalogue de se...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : PLEINIèRE SECOND JOURTECHDAYS PARIS 2012 : PLEINIèRE SECOND JOUR par ROMELARD Fabrice
Après une première journée dédiée aux développeurs, cette seconde journée est dédiée au monde des entreprises et de ses applications. Ainsi, cette pleinière est dédiée à faire un 360 de l'évolution des applications Business aux demandes ac...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2012 : RETOUR D'EXPéRIENCE SUR LA MISE EN PLACE D'UN CLOUD PRIVéTECHDAYS PARIS 2012 : RETOUR D'EXPéRIENCE SUR LA MISE EN PLACE D'UN CLOUD PRIVé par ROMELARD Fabrice
Speaker : Guillaume Rochette Cette session est dédiée à fournir le retour sur la mise en place d'un cloud privé (IaaS) par Osiatis pour son compte ou celui de ses clients. Ce projet s'est déroulé sur 4 mois et a permis de faire évoluer...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Logiciels
Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Easy-Planning (1.0.0.1)EASY-PLANNING (1.0.0.1)Basé sur les mêmes principes que MyPlanning, Easy-Planning permet de créer des plannings sous la ... Cliquez pour télécharger Easy-Planning COLLECTOR PLUS (3.00B)COLLECTOR PLUS (3.00B)COLLECTOR PLUS version 3.00B est un logiciel utilisant une base de données alimentée par :
- L... Cliquez pour télécharger COLLECTOR PLUS PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V7.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO LettresFaciles 2011 (8.0.0.1)LETTRESFACILES 2011 (8.0.0.1)LettresFaciles est un logiciel facilitant la création et la rédaction de lettres types.
Son inte... Cliquez pour télécharger LettresFaciles 2011
|