Exemplo n.º 1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "ShareX backup (*.sxb)|*.sxb|All files (*.*)|*.*";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    btnExport.Enabled      = false;
                    btnImport.Enabled      = false;
                    pbExportImport.Visible = true;

                    TaskEx.Run(() =>
                    {
                        ExportImportManager.Import(ofd.FileName);
                        Program.LoadAllSettings();
                    },
                               () =>
                    {
                        UpdateSettings();
                        pbExportImport.Visible = false;
                        btnExport.Enabled      = true;
                        btnImport.Enabled      = true;
                    });
                }
            }
        }
Exemplo n.º 2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.DefaultExt = "sxb";
                sfd.FileName   = "ShareX_backup.sxb";
                sfd.Filter     = "ShareX backup (*.sxb)|*.sxb|All files (*.*)|*.*";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    btnExport.Enabled      = false;
                    btnImport.Enabled      = false;
                    pbExportImport.Visible = true;

                    TaskEx.Run(() =>
                    {
                        Program.SaveAllSettings();
                        ExportImportManager.Export(sfd.FileName);
                    },
                               () =>
                    {
                        pbExportImport.Visible = false;
                        btnExport.Enabled      = true;
                        btnImport.Enabled      = true;
                    });
                }
            }
        }
Exemplo n.º 3
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "ShareX backup (*.sxb)|*.sxb|All files (*.*)|*.*";

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    btnExport.Enabled      = false;
                    btnImport.Enabled      = false;
                    pbExportImport.Visible = true;

                    string importPath = ofd.FileName;

                    DebugHelper.WriteLine("Import started: " + importPath);

                    TaskEx.Run(() =>
                    {
                        ExportImportManager.Import(importPath);

                        Program.LoadAllSettings();
                    },
                               () =>
                    {
                        if (!IsDisposed)
                        {
                            UpdateControls();

                            pbExportImport.Visible = false;
                            btnExport.Enabled      = true;
                            btnImport.Enabled      = true;
                        }

                        LanguageHelper.ChangeLanguage(Program.Settings.Language);

                        Program.MainForm.UpdateControls();

                        DebugHelper.WriteLine("Import completed: " + importPath);
                    });
                }
            }
        }
Exemplo n.º 4
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.DefaultExt = "sxb";
                sfd.FileName   = $"ShareX-{Application.ProductVersion}-backup.sxb";
                sfd.Filter     = "ShareX backup (*.sxb)|*.sxb|All files (*.*)|*.*";

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    btnExport.Enabled      = false;
                    btnImport.Enabled      = false;
                    pbExportImport.Visible = true;

                    string exportPath = sfd.FileName;

                    DebugHelper.WriteLine("Export started: " + exportPath);

                    TaskEx.Run(() =>
                    {
                        Program.SaveAllSettings();

                        ExportImportManager.Export(exportPath);
                    },
                               () =>
                    {
                        if (!IsDisposed)
                        {
                            pbExportImport.Visible = false;
                            btnExport.Enabled      = true;
                            btnImport.Enabled      = true;
                        }

                        DebugHelper.WriteLine("Export completed: " + exportPath);
                    });
                }
            }
        }