private void btnreplace_Click(object sender, EventArgs e)
        {
            Button b1       = sender as Button;
            string filename = b1.Tag.ToString();
            string ext      = Path.GetExtension(filename);

            fd1.Filter = ext + "|*" + ext;

            if (fd1.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(fd1.FileName))
                {
                    File.Copy(fd1.FileName, Path.GetDirectoryName(filename) + "\\" + Path.GetFileName(filename), true);

                    using (FileStream m1 = new FileStream(filename, FileMode.Open, FileAccess.Read)) {
                        PictureBox pb = b1.Parent.Controls["gb1"].Controls["pbPicture"] as PictureBox;
                        pb.SizeMode = PictureBoxSizeMode.StretchImage;
                        pb.Image    = Image.FromStream(m1);
                    }

                    frmToast t1 = new frmToast();
                    t1.setComment = "فایل مورد نظر تغییر کرد";
                    t1.Show();
                }
            }
        }
        private void bwcompile_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                File.Copy(Application.StartupPath + "\\tool\\book\\dist\\book.apk", Application.StartupPath + "\\template\\" + Filename, true);

                try
                {
                    myClass.clearFolder(Application.StartupPath + "\\tool\\book");
                    Directory.Delete(Application.StartupPath + "\\tool\\book");
                }
                catch (Exception) { }

                frmToast t1 = new frmToast();
                t1.setComment = "تغیرات قالب با موفقیت ذخیره شد";
                t1.Show();
                btncancel_Click(null, null);
            }
            catch (Exception)
            {
                frmToast t1 = new frmToast();
                t1.setComment = "عملیات با خطا مواجه شد";
                t1.Show();
                Dispose();
            }
        }
        private void btndelete_Click(object sender, EventArgs e)
        {
            Button b1       = sender as Button;
            string filename = b1.Tag.ToString();

            string ext = Path.GetExtension(filename);

            try
            {
                if (MessageBox.Show("آیا مایل به حذف فایل هستید؟", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    File.Delete(filename);

                    b1.Parent.Enabled = false;

                    PictureBox pb = b1.Parent.Controls["gb1"].Controls["pbPicture"] as PictureBox;
                    pb.SizeMode = PictureBoxSizeMode.StretchImage;
                    pb.Image    = Remote_Computer.Properties.Resources.No_picture_available;

                    frmToast t1 = new frmToast();
                    t1.setComment = "فایل مورد نظر حذف شد";
                    t1.Show();
                }
            }
            catch (Exception)
            {
            }
        }
Exemple #4
0
        private void btndelete_Click(object sender, EventArgs e)
        {
            Button b1 = sender as Button;

            if (MessageBox.Show("آیا مایل به حذف فایل هستید؟", "توجه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    File.Delete(b1.Tag.ToString());
                    frmToast t1 = new frmToast();
                    t1.setComment = "فایل مورد نظر حذف شد";
                    t1.Show();
                    b1.Parent.Enabled = false;
                }
                catch (Exception) { }
            }
        }
Exemple #5
0
        private void btnreplace_Click(object sender, EventArgs e)
        {
            Button b1       = sender as Button;
            string filename = b1.Tag.ToString();
            string ext      = Path.GetExtension(filename);

            fd1.Filter = ext + "|*" + ext;

            if (fd1.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(fd1.FileName))
                {
                    File.Copy(fd1.FileName, Application.StartupPath + "\\tool\\book\\assets\\" + Path.GetFileName(filename), true);

                    frmToast t1 = new frmToast();
                    t1.setComment = "فایل مورد نظر تغییر کرد";
                    t1.Show();
                }
            }
        }