Exemplo n.º 1
0
 public ResizeTask(DirectoryInfo imgRootDir, string title, IList <Media> medias, IWin32Window owner, ResizeConfig resizeConfig)
 {
     this.rootDir        = imgRootDir;
     this.title          = title;
     this.medias         = medias;
     this.t              = new Thread(new ThreadStart(Worker));
     this.t.IsBackground = true;
     this.owner          = owner;
     this.resizeConfig   = resizeConfig;
     this.pb             = new ProgressBarBox("Resizing " + title + " Media", 1, medias.Count, 1);
 }
Exemplo n.º 2
0
 public ResizeFilter(ResizeConfig config) : base("resize")
 {
     _resizeConfig = config;
 }
Exemplo n.º 3
0
        private void toolStripMenuItem_Resize_Click(object sender, EventArgs e)
        {
            IList <Media> selectedMedias = this.dataGridView.SelectedObjects();

            if (selectedMedias.Count > 0)
            {
                DirectoryInfo imgRootDir = new DirectoryInfo(PathUtils.GetImgRootPath());
                string        title      = "selected";
                ResizeTask    task       = new ResizeTask(imgRootDir, title, selectedMedias, this, ResizeConfig.getInstance());
                task.t.Start();
                if (task.pb.ShowDialog(this) == DialogResult.Cancel)
                {
                    task.stopflag = true;
                }
            }
            else
            {
                return;
            }
        }
Exemplo n.º 4
0
        private void toolStripMenuItem_Resize_Click(object sender, EventArgs e)
        {
            IList <Project> selectedProjects = this.dataGridView.SelectedObjects();

            if (selectedProjects.Count > 0)
            {
                DirectoryInfo imgRootDir = new DirectoryInfo(PathUtils.GetImgRootPath());
                foreach (Project pro in selectedProjects)
                {
                    if (pro == null || string.IsNullOrWhiteSpace(pro.id))
                    {
                        continue;
                    }
                    string title = pro.name;
                    MediaQueryCondition mediaQC = new MediaQueryCondition();
                    mediaQC.project_id = pro.id;
                    IList <Media> medias = this.mediaDao.query(mediaQC);
                    ResizeTask    task   = new ResizeTask(imgRootDir, title, medias, this, ResizeConfig.getInstance());
                    task.t.Start();
                    if (task.pb.ShowDialog(this) == DialogResult.Cancel)
                    {
                        task.stopflag = true;
                    }
                }
            }
            else
            {
                return;
            }
        }
Exemplo n.º 5
0
        private void renderDefault()
        {
            this.config = ResizeConfig.getInstance();
            this.checkBox_EnableLogo.Checked = this.config.enableLogo;
            foreach (Byte contentType in this.config.enableLogoTypes)
            {
                switch (contentType)
                {
                case Media.CONTENT_TYPE_FLOORPLAN:
                    this.checkBox_Enable_Floorplan.Checked = true;
                    break;

                case Media.CONTENT_TYPE_RENDER_INTERNAL:
                    this.checkBox_Enable_RenderInternal.Checked = true;
                    break;

                case Media.CONTENT_TYPE_RENDER_EXTERNAL:
                    this.checkBox_Enable_RenderExternal.Checked = true;
                    break;

                case Media.CONTENT_TYPE_PHOTOGRAPH:
                    this.checkBox_Enable_Photo.Checked = true;
                    break;

                case Media.CONTENT_TYPE_ENV:
                    this.checkBox_Enable_Env.Checked = true;
                    break;

                case Media.CONTENT_TYPE_FLOORPLATE:
                    this.checkBox_Enable_Floorplate.Checked = true;
                    break;

                case Media.CONTENT_TYPE_OTHERS:
                    this.checkBox_Enable_Others.Checked = true;
                    break;

                case Media.CONTENT_TYPE_PROJECT_OVERVIEW:
                    this.checkBox_Enable_ProjectOveriew.Checked = true;
                    break;

                case Media.CONTENT_TYPE_PROJECT_DESCRIPTION:
                    this.checkBox_Enable_ProjectDesc.Checked = true;
                    break;

                case Media.CONTENT_TYPE_PROJECT_FEATURE:
                    this.checkBox_Enable_ProjectFeature.Checked = true;
                    break;

                case Media.CONTENT_TYPE_PROJECT_SCHEME:
                    this.checkBox_Enable_ProjectScheme.Checked = true;
                    break;

                default:
                    break;
                }
            }
            this.textBox_SmallLogo.Text  = this.config.smallLogo;
            this.textBox_MediumLogo.Text = this.config.mediumLogo;
            this.textBox_LargeLogo.Text  = this.config.largeLogo;
            this.numericUpDown_Floorplan_MediumHeight.Value = this.config.floorplan_mediumHeight;
            this.numericUpDown_Floorplan_MediumWidth.Value  = this.config.floorplan_mediumWidth;
            this.numericUpDown_Floorplan_SmallHeight.Value  = this.config.floorplan_smallHeight;
            this.numericUpDown_Floorplan_SmallWidth.Value   = this.config.floorplan_smallWidth;
            this.numericUpDown_Overview_MediumHeight.Value  = this.config.overview_mediumHeight;
            this.numericUpDown_Overview_MediumWidth.Value   = this.config.overview_mediumWidth;
            this.numericUpDown_Overview_SmallHeight.Value   = this.config.overview_smallHeight;
            this.numericUpDown_Overview_SmallWidth.Value    = this.config.overview_smallWidth;
        }
Exemplo n.º 6
0
        private void saveConfig()
        {
            ResizeConfig cfg = ResizeConfig.getInstance();

            Boolean enableLogo             = this.checkBox_EnableLogo.Checked;
            Int32   floorplan_smallWidth   = (Int32)this.numericUpDown_Floorplan_SmallWidth.Value;
            Int32   floorplan_smallHeight  = (Int32)this.numericUpDown_Floorplan_SmallHeight.Value;
            Int32   floorplan_mediumWidth  = (Int32)this.numericUpDown_Floorplan_MediumWidth.Value;
            Int32   floorplan_mediumHeight = (Int32)this.numericUpDown_Floorplan_MediumHeight.Value;
            string  smallLogo             = this.textBox_SmallLogo.Text;
            string  mediumLogo            = this.textBox_MediumLogo.Text;
            string  largeLogo             = this.textBox_LargeLogo.Text;
            Int32   overview_smallWidth   = (Int32)this.numericUpDown_Overview_SmallWidth.Value;
            Int32   overview_smallHeight  = (Int32)this.numericUpDown_Overview_SmallHeight.Value;
            Int32   overview_mediumWidth  = (Int32)this.numericUpDown_Overview_MediumWidth.Value;
            Int32   overview_mediumHeight = (Int32)this.numericUpDown_Overview_MediumHeight.Value;

            cfg.enableLogo = enableLogo;
            cfg.enableLogoTypes.Clear();
            if (this.checkBox_Enable_Floorplan.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_FLOORPLAN);
            }
            if (this.checkBox_Enable_RenderInternal.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_RENDER_INTERNAL);
            }
            if (this.checkBox_Enable_RenderExternal.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_RENDER_EXTERNAL);
            }
            if (this.checkBox_Enable_Photo.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_PHOTOGRAPH);
            }
            if (this.checkBox_Enable_Env.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_ENV);
            }
            if (this.checkBox_Enable_Floorplate.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_FLOORPLATE);
            }
            if (this.checkBox_Enable_Others.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_OTHERS);
            }
            if (this.checkBox_Enable_ProjectOveriew.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_PROJECT_OVERVIEW);
            }
            if (this.checkBox_Enable_ProjectDesc.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_PROJECT_DESCRIPTION);
            }
            if (this.checkBox_Enable_ProjectFeature.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_PROJECT_FEATURE);
            }
            if (this.checkBox_Enable_ProjectScheme.Checked)
            {
                cfg.enableLogoTypes.Add(Media.CONTENT_TYPE_PROJECT_SCHEME);
            }
            cfg.floorplan_smallWidth   = floorplan_smallWidth;
            cfg.floorplan_smallHeight  = floorplan_smallHeight;
            cfg.floorplan_mediumWidth  = floorplan_mediumWidth;
            cfg.floorplan_mediumHeight = floorplan_mediumHeight;
            cfg.smallLogo             = smallLogo;
            cfg.mediumLogo            = mediumLogo;
            cfg.largeLogo             = largeLogo;
            cfg.overview_smallWidth   = overview_smallWidth;
            cfg.overview_smallHeight  = overview_smallHeight;
            cfg.overview_mediumWidth  = overview_mediumWidth;
            cfg.overview_mediumHeight = overview_mediumHeight;
        }
Exemplo n.º 7
0
        private void button_Resize_Click(object sender, EventArgs e)
        {
            this.saveConfig();
            IList <Media> medias     = mediaDao.queryAll();
            DirectoryInfo imgRootDir = new DirectoryInfo(PathUtils.GetImgRootPath());
            string        title      = "all";
            ResizeTask    task       = new ResizeTask(imgRootDir, title, medias, this, ResizeConfig.getInstance());

            task.t.Start();
            if (task.pb.ShowDialog(this) == DialogResult.Cancel)
            {
                task.stopflag = true;
            }
        }