• 大小: 0.14M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: Xml  学习  

资源简介

 public Turntable()
        {
            InitializeComponent();

            int angle = 5029;
            for (int i = 0; i < 16; i )
            {
                angle = 22;
                _ListAngle.Add(angle);
            }
        }

        /// <summary>
        /// 保存八个角度
        /// </summary>
        List<int> _ListAngle = new List<int>();
        /// <summary>
        /// 产生随机数
        /// </summary>
        Random _Random = new Random();
        int _Index = 0;
        int _OldAngle = 0;
        private void btnStartTurntable_Click(object sender, RoutedEventArgs e)
        {
            btnStartTurntable.IsEnabled = false;
            _Index = _Random.Next(0, 16);
            //_Index = 2;
            Storyboard sb = (Storyboard)this.FindResource("zhuandong");
            sb.Completed -= this.sb_Completed;
            sb.Completed = new EventHandler(sb_Completed);
            ((SplineDoubleKeyFrame)((DoubleAnimationUsingKeyFrames)sb.Children[0]).KeyFrames[0]).Value = _OldAngle;
            ((SplineDoubleKeyFrame)((DoubleAnimationUsingKeyFrames)sb.Children[0]).KeyFrames[3]).Value = _ListAngle[_Index];
            //((SplineDoubleKeyFrame)((DoubleAnimationUsingKeyFrames)sb.Children[0]).KeyFrames[3]).Value = 5218;
            sb.Begin();
        }

        void sb_Completed(object sender, EventArgs e)
        {
            DispatcherTimer dt = new DispatcherTimer();
            dt.Interval = TimeSpan.FromSeconds(0.3);
            dt.Tick = delegate 
            {
                dt.Stop();
                _OldAngle = (_ListAngle[_Index] % 360);

                btnStartTurntable.IsEnabled = true;
                AwardProcess(GetAward(_ListAngle[_Index]));
            };
            dt.Start();
        }

        public delegate void AwardDelegate(Award award);

        /// <summary>
        /// 返回转到的奖项信息
        /// </summary>
        public event AwardDelegate AwardProcess;

        private Award GetAward(int angle)
        {

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace BanditTicket
{
    /// 
    /// App.xaml 的交互逻辑
    /// 

    public partial class App : Application
    {
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-01-07 14:25  BanditTicket\
     目录           0  2014-01-07 14:25  BanditTicket\BanditTicket\
     文件         328  2013-04-22 20:44  BanditTicket\BanditTicket\App.xaml
     文件         308  2012-09-10 11:25  BanditTicket\BanditTicket\App.xaml.cs
     文件        4675  2013-04-22 20:57  BanditTicket\BanditTicket\BanditTicket.csproj
     文件         143  2012-09-10 11:26  BanditTicket\BanditTicket\BanditTicket.csproj.user
     目录           0  2014-01-07 14:25  BanditTicket\BanditTicket\Properties\
     文件        2189  2012-09-10 11:25  BanditTicket\BanditTicket\Properties\AssemblyInfo.cs
     文件        2862  2012-09-11 15:07  BanditTicket\BanditTicket\Properties\Resources.Designer.cs
     文件        5817  2012-09-11 15:07  BanditTicket\BanditTicket\Properties\Resources.resx
     文件        1097  2012-09-10 11:25  BanditTicket\BanditTicket\Properties\Settings.Designer.cs
     文件         201  2012-09-10 11:25  BanditTicket\BanditTicket\Properties\Settings.settings
     文件       10293  2014-01-07 14:25  BanditTicket\BanditTicket\Turntable.xaml
     文件        4938  2014-01-07 13:11  BanditTicket\BanditTicket\Turntable.xaml.cs
     文件         525  2014-01-07 13:16  BanditTicket\BanditTicket\WindowTurntable.xaml
     文件         883  2012-09-14 17:50  BanditTicket\BanditTicket\WindowTurntable.xaml.cs
     目录           0  2014-01-07 14:25  BanditTicket\BanditTicket\bin\
     目录           0  2014-01-07 14:25  BanditTicket\BanditTicket\bin\Debug\
     文件       20992  2014-01-07 13:16  BanditTicket\BanditTicket\bin\Debug\BanditTicket.exe
     文件       46592  2014-01-07 13:16  BanditTicket\BanditTicket\bin\Debug\BanditTicket.pdb
     文件       11600  2014-06-30 09:52  BanditTicket\BanditTicket\bin\Debug\BanditTicket.vshost.exe
     文件         490  2010-03-17 22:39  BanditTicket\BanditTicket\bin\Debug\BanditTicket.vshost.exe.manifest
     文件       23849  2014-01-07 10:00  BanditTicket\BanditTicket\bin\Debug.zip
     目录           0  2014-06-30 09:52  BanditTicket\BanditTicket\bin\Release\
     目录           0  2014-01-07 14:25  BanditTicket\BanditTicket\obj\
     目录           0  2014-01-07 14:25  BanditTicket\BanditTicket\obj\x86\
     目录           0  2014-06-30 09:52  BanditTicket\BanditTicket\obj\x86\Debug\
     文件        2226  2014-01-07 13:16  BanditTicket\BanditTicket\obj\x86\Debug\App.g.cs
     文件        2226  2014-06-30 09:52  BanditTicket\BanditTicket\obj\x86\Debug\App.g.i.cs
     文件         180  2014-01-07 13:16  BanditTicket\BanditTicket\obj\x86\Debug\BanditTicket.Properties.Resources.resources
     文件        6702  2014-06-30 09:52  BanditTicket\BanditTicket\obj\x86\Debug\BanditTicket.csproj.FileListAbsolute.txt
............此处省略33个文件信息

评论

共有 条评论