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; }
private void btnOpenExisting_Click(object sender, EventArgs e) { OpenFileDialog OpenFileDialog = new OpenFileDialog(); OpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); OpenFileDialog.Filter = AMTConfig.PackageExtension + " files (*" + AMTConfig.PackageExtension + ")|*" + AMTConfig.PackageExtension; OpenFileDialog.FilterIndex = 2; OpenFileDialog.RestoreDirectory = true; if (OpenFileDialog.ShowDialog() == DialogResult.OK) { //Clear UI Before this and Data Package.PackageState = AMTUtil.State.LOADED; ClearElements(); InitData(); //File Loading if (!AMTUtil.OpenPackage(Package, OpenFileDialog.FileName)) { MessageBox.Show("Project Load Error!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Package = new AMTPackage(); Package.PackageState = AMTUtil.State.EMPTY; } else { PopulateResources(); lbAssets.SelectedIndex = 0; PopulateAssetFrames(); lbGifFrames.SelectedIndex = 0; PopulateUI(); } } }