Exemplo n.º 1
0
        private void btnFrameRef_Click(object sender, EventArgs e)
        {
            int index = lbFrames.SelectedIndex;

            if (Package.PackageState != AMTUtil.State.READY)
            {
                return;
            }
            string FileName = (string)Selection_Prompt <string> .ShowDialog("Select a action you want to add as reference", "Action Selection", Package.Animation.Manifest.ActionFileName);

            if (FileName == null)
            {
                return;
            }
            //Cannot Have reference conflict
            string CheckResult = AMTUtil.CheckReference(Package.Animation, Package.Animation.Actions[lbActions.SelectedIndex],
                                                        AMTUtil.GetActionFromName(Package.Animation, Path.GetFileNameWithoutExtension(FileName)));

            if (CheckResult != null)
            {
                MessageBox.Show("Reference conflict in: " + CheckResult, "Critical Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //lblDebug.Text = FileName;
            Package.Animation.Actions[lbActions.SelectedIndex].Frames.Add(new AMTFrame());
            Package.Animation.Actions[lbActions.SelectedIndex].Frames.Last().Delay     = (int)nudDefaultDelay.Value;
            Package.Animation.Actions[lbActions.SelectedIndex].Frames.Last().ActionRef = Path.GetFileNameWithoutExtension(FileName);
            Package.Animation.Actions[lbActions.SelectedIndex].Frames.Last().MD5       = null;
            Package.Animation.Actions[lbActions.SelectedIndex].Frames.Last().Tags.Add("null");
            PopulateFrames();
            lbFrames.SelectedIndex = lbFrames.Items.Count - 1;
        }
Exemplo n.º 2
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);
             }
         }
     }
 }
Exemplo n.º 3
0
 private void btnShowPreview_Click(object sender, EventArgs e)
 {
     //When more than one frame, create duplicate action and view action
     if (Package.PackageState != AMTUtil.State.READY)
     {
         return;
     }
     if (lbFrames.SelectedIndex == -1)
     {
         MessageBox.Show("You need to select a frame!");
         return;
     }
     if (lbFrames.SelectedItems.Count > 1)
     {
         MessageBox.Show("You cannot view more than one frame.");
         return;
     }
     if (Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].ActionRef == null)
     {
         AMTResource  PreviewResource = AMTUtil.GetResourceFromName(Package, Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].Resource);
         FramePreview PreviewWindow   = new FramePreview(AMTUtil.BytesToImage(PreviewResource.Frames[Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].FrameRef]));
         PreviewWindow.Show();
     }
     else
     {
         ActionPreview PreviewWindow = new ActionPreview(Package,
                                                         AMTUtil.GetActionFromName(Package.Animation, Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].ActionRef));
         PreviewWindow.Show();
     }
 }
Exemplo n.º 4
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"));
 }