Esempio n. 1
0
        private void btnImageBrowse_Click(object sender, EventArgs e)
        {
            string path = FileDialog.ShowOpen(FileDialog.Context.Image);

            if (!string.IsNullOrEmpty(path))
            {
                ChangeImage(path);
            }
        }
Esempio n. 2
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            string filename = FileDialog.ShowOpen(FileDialog.Context.Document);

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            Globals.Root.OpenFile(filename);
            if (Globals.Root.CurrentDocument != null)             // triggers may be Null if it was a SAW6 document and the user rejected it after warnings
            {
                Globals.Root.ShowEditScreen(Globals.Root.CurrentDocument);
            }
        }
Esempio n. 3
0
        private void btnSoundBrowse_Click(object sender, EventArgs e)
        {
            string path = FileDialog.ShowOpen(FileDialog.Context.Sound);

            if (string.IsNullOrEmpty(path))
            {
                return;
            }
            SharedResource sound = (SharedResource)Globals.Root.CurrentDocument.AddSharedResourceFromFile(path, m_Transaction, false);

            m_Scriptables.First().Sound = new SharedReference <SharedResource>(sound);
            pnlGraphic.Invalidate();
            ReflectSoundButtons();
            Updated();
        }
Esempio n. 4
0
        public void btnChangeActivityIcon_Click(object sender, EventArgs e)
        {
            string filename = FileDialog.ShowOpen(FileDialog.Context.Image);

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            m_Image = new MemoryImage(filename);
            m_Image.ChangeToBitmap(new Size(144, 144));
            pnlPreviewActivityIcon.Image = m_Image.GetNetImage();
            EnableOK();
            Globals.OnAvailableActivitiesChanged();
            // We should also raise this if the text changes; but that's more complicated if we don't want to raise numerous events, and I'm not sure it's worth the effort
        }
Esempio n. 5
0
 public void btnOK_Click(object sender, EventArgs e)
 {
     if (rdoOther.Checked)
     {
         string file = FileDialog.ShowOpen(FileDialog.Context.BackgroundDocument);
         if (string.IsNullOrEmpty(file))
         {
             return;
         }
         m_OtherFile  = file;
         DialogResult = DialogResult.OK;
     }
     else
     {
         DialogResult = DialogResult.OK;
     }
 }
Esempio n. 6
0
        public void btnLoad_Click(object sender, EventArgs e)
        {
            string filename = FileDialog.ShowOpen(FileDialog.Context.Image, "[Filter_Image1]");

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            Transaction transaction = new Transaction();
            SharedImage texture     = (SharedImage)m_Document.AddSharedResourceFromFile(filename, transaction);

            Globals.Root.StoreNewTransaction(transaction);
            if (texture != null)
            {
                m_Chosen          = texture;
                this.DialogResult = DialogResult.OK;
            }
        }
Esempio n. 7
0
        public void btnImageDisc_Click(object sender, EventArgs e)
        {
            string filename = FileDialog.ShowOpen(FileDialog.Context.Image);

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            try
            {
                m_NewImage = (SharedImage)Globals.Root.CurrentDocument.AddSharedResourceFromFile(filename, m_Transaction);
                ImageChanged();
                chkDisplayFromAction.Checked = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 8
0
        public void btnAddImage_Click(object sender, EventArgs e)
        {
            string filename = FileDialog.ShowOpen(FileDialog.Context.Image);

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            try
            {
                if (m_Style.CustomImage[(int)State] == null)
                {
                    m_Style.CustomImage[(int)State] = new ScalableImage();
                }
                Img.AddImageFromDisc(filename);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            m_ImageIndex = Img.Images.Count - 1;
            DisplayImageIndex();
        }
Esempio n. 9
0
        public void lnkBackgroundImage_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Alternate filter used; non-bitmaps may not work (especially if tiling)
            string filename = FileDialog.ShowOpen(FileDialog.Context.Image, "[Filter_Image1]");

            if (string.IsNullOrEmpty(filename))
            {
                return;
            }
            m_Page.BackgroundImage = (SharedImage)Globals.Root.CurrentDocument.AddSharedResourceFromFile(filename, m_Transaction);
            if (m_Page.BackgroundImage != null)                       // just in case
            {
                SizeF imageSize = m_Page.BackgroundImage.GetSize(64); // small size provided here means a resource (!?!) doesn't trigger
                if (imageSize.Width > 100 && imageSize.Height > 100 && Globals.Root.CurrentDocument.Count == 1)
                {
                    // This is only done if the document has a single page.
                    if (GUIUtilities.QuestionBox(Strings.Item("Paper_MatchImageSize"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        SetSizeToMatchImage();
                    }
                }
            }
            ReflectPaper();
        }