Beispiel #1
0
        /// <summary>
        /// Copie tabloid engine files
        /// on update (maj=true)
        /// on first save (forceKeepConfig=true)
        /// on click on publish (maj=false, forcekeepConfig=false)
        /// </summary>
        /// <param name="config"></param>
        /// <param name="maj"></param>
        /// <param name="forceKeepConfig"></param>
        public static void publication(ConfigFilesCollection config, IWin32Window own, bool maj = false, bool forceKeepConfig = false)
        {
            var cfg = new publishConfig();


            if (maj)
            {
                //use path from config file
                var path = config.ConfigFiles[0].ConfigFilePath;
                cfg.DestinationPath = path.Substring(0, path.IndexOf("config", StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                var fbd = new FolderBrowserDialog();

                DialogResult result = fbd.ShowDialog();

                if (result != DialogResult.OK)
                {
                    return;
                }

                cfg.DestinationPath = fbd.SelectedPath;
            }


            string[] files = Directory.GetFiles(cfg.DestinationPath);

            cfg.KeepWebConfig = forceKeepConfig;

            if (!forceKeepConfig && (files.Length > 0 || Directory.GetDirectories(cfg.DestinationPath).Length > 0))
            {
                var majFrm = new maj(cfg.DestinationPath);

                if (majFrm.ShowDialog() == DialogResult.OK)
                {
                    if (majFrm.chkSAV.Checked)
                    {
                        makeZipSite(cfg.DestinationPath, own);
                    }
                    cfg.KeepOpenJs    = majFrm.chkOpenJs.Checked;
                    cfg.KeepUpload    = majFrm.chkUpload.Checked;
                    cfg.KeepWebConfig = majFrm.chkWebConfig.Checked;
                    cfg.KeepImages    = majFrm.chkImg.Checked;
                }
                else
                {
                    return;
                }
            }

            Tools.publication(config, cfg, own);
        }
Beispiel #2
0
        /// <summary>
        /// Copy tabloid engine to selected path
        /// </summary>
        /// <param name="destinationPath">destination path</param>
        static void publication(ConfigFilesCollection config, publishConfig cfg, IWin32Window own)
        {
            //var wf = new WaitingForm(wrPublication);
            //wf.sho();
            //Thread.Sleep(2000);
            try
            {
                var _wf = new WaitingForm(wrPublication)
                {
                    Text        = Properties.Resources.Publishing,
                    progressBar = { Style = ProgressBarStyle.Marquee }
                };

                _wf.Wr.RunWorkerAsync(new object[] { config, cfg, own });
                _wf.ShowDialog();
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(own, Properties.Resources.SavingError + ex, Properties.Resources.Erreur, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }