예제 #1
0
 public ActionPreview(AMTPackage Package, AMTAction Action)
 {
     InitializeComponent();
     PreviewPackage = Package;
     PreviewAction = Action;
     ExpandedActionPlayer = new AMTActionPlayer(Package, Action);
     this.Text = this.Text + " " + Action.Name;
     PlayTimer.Enabled = true;
 }
예제 #2
0
 public MainWindow()
 {
     InitializeComponent();
     Package = new AMTPackage();
     bool result = AMTUtil.OpenPackage(Package, AMTUtil.GetAbsPath(Directory.GetCurrentDirectory(), "AMT.apkg"));
     if (result)
     {
         //Set current action
         Default = new AMTActionPlayer(Package.Animation, AMTUtil.GetDefaultAction(Package.Animation));
         CurrentAction = Default;
         Timer = new DispatcherTimer();
         Timer.Interval = TimeSpan.FromMilliseconds(10);
         Timer.Tick += Timer_Tick;
         Timer.Start();
         this.MouseDoubleClick += MainWindow_MouseDoubleClick;
         MEAudio.Play();
     }
     else
     {
         this.Close();
         System.Environment.Exit(0);
     }
     this.MouseDown += Window_MouseDown;
 }
예제 #3
0
 private void CMainDisplay_Drop(object sender, DragEventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to recycle these files?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
     {
         return;
     }
     // When File is dropped on top of widget Main Display
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         // Note that you can have more than one file.
         string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
         Timer.Interval = TimeSpan.FromMilliseconds(10);
         Default = CurrentAction;
         CurrentAction = new AMTActionPlayer(Package.Animation, AMTUtil.GetActionFromName(Package.Animation, "recycle"));
         // Assuming you have one file that you care about, pass it off to whatever
         // handling code you have defined.
         foreach (string s in files)
         {
             Console.WriteLine(s);
             if(File.GetAttributes(s) == FileAttributes.Directory)
                 FileSystem.DeleteDirectory(s, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
             else
                 FileSystem.DeleteFile(s, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
         }
     }
 }
예제 #4
0
 void Timer_Tick(object sender, EventArgs e)
 {
     if (CurrentAction != Default && CurrentAction.GetLoopTime() > 1)
         CurrentAction = Default;
     AMTFrame f = CurrentAction.GetNextFrameWithRandomness();
     Console.WriteLine("Delay: {0}", f.Delay);
     CMainDisplay.Background = new ImageBrush(AMTUtil.BytesToImageSource(Package.CurrentResource.Frames[f.FrameRef]));
     //Text(CTopLeft, 10, 100, "Timer Triggered", Color.FromRgb(0, 100, 100));
     Timer.Interval = TimeSpan.FromMilliseconds(f.Delay);
 }
예제 #5
0
 void MainWindow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     Timer.Interval = TimeSpan.FromMilliseconds(10);
     Default = CurrentAction;
     CurrentAction = new AMTActionPlayer(Package.Animation, AMTUtil.GetActionFromName(Package.Animation, "ribbon"));
 }
예제 #6
0
 private void PlayTimer_Tick(object sender, EventArgs e)
 {
     //Update Action
     if(ExpandedActionPlayer.GetLoopTime() > 0)
         ExpandedActionPlayer = new AMTActionPlayer(PreviewPackage, PreviewAction);
     //Clear, load another frame, update inteveral
     ClearPictureBox();
     lblCurrentFrame.Text = ExpandedActionPlayer.GetCurrentFrame().ToString();
     KeyValuePair<AMTFrame, byte[]> f = ExpandedActionPlayer.GetNextFrameWithRandomness();
     LoadFrame(f.Value);
     lblCurrentDelay.Text = f.Key.Delay.ToString();
     PlayTimer.Interval = f.Key.Delay;
 }