Ejemplo n.º 1
0
        private void btnLoadExistingAsset_Click(object sender, EventArgs e)
        {
            if (Package.PackageState == AMTUtil.State.EMPTY)
            {
                return;
            }
            OpenFileDialog OpenFileDialog = new OpenFileDialog();

            OpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            OpenFileDialog.Filter           = "resource files (*" + AMTConfig.ResourcePostExtension + ")|*" + AMTConfig.ResourcePostExtension;
            OpenFileDialog.FilterIndex      = 2;
            OpenFileDialog.RestoreDirectory = true;
            if (OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                Package.AddExistingResource(OpenFileDialog.FileName);
                PopulateResources();
                if (Package.PackageState != AMTUtil.State.READY)
                {
                    if (MessageBox.Show("Do you want to initialize animation using this resource?", "Initialize Animation",
                                        MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                    {
                        AMTUtil.InitAnimation(Package, Package.CurrentResource.Name);
                        PopulateUI();
                    }
                }
            }
            Package.SavePackage();
        }
Ejemplo n.º 2
0
        private void btnNewAsset_Click(object sender, EventArgs e)
        {
            if (Package.PackageState == AMTUtil.State.EMPTY)
            {
                return;
            }
            string PromptValue = InputPrompt.ShowDialog("Name of the resource", "New Resource");

            if (PromptValue == null)
            {
                return;
            }
            if (PromptValue == "")
            {
                MessageBox.Show("Input Empty!");
            }
            OpenFileDialog OpenFileDialog = new OpenFileDialog();

            OpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            OpenFileDialog.Filter           = "gif files (*.gif)|*.gif";
            OpenFileDialog.FilterIndex      = 2;
            OpenFileDialog.RestoreDirectory = true;
            if (OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                if (!Package.AddResource(PromptValue, OpenFileDialog.FileName, ResourceType.GIF))
                {
                    MessageBox.Show("Resource Load Error!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                PopulateResources();
            }
            if (Package.PackageState != AMTUtil.State.READY)
            {
                if (MessageBox.Show("Do you want to initialize animation using this resource?", "Initialize Animation",
                                    MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    AMTUtil.InitAnimation(Package, Package.CurrentResource.Name);
                    PopulateUI();
                }
            }
        }