private void textBoxAssetFileName_TextChanged(object sender, EventArgs e)
        {
            TextBox tb = (TextBox)sender;

            if (!AssetInfo.AssetFileNameIsOk(tb.Text))
            {
                errorProvider1.SetError(tb, "Asset file name is not compatible with Media Services");
            }
            else
            {
                errorProvider1.SetError(tb, String.Empty);
            }
        }
        private void textBoxAssetFileName_TextChanged(object sender, EventArgs e)
        {
            TextBox tb = (TextBox)sender;

            if (!AssetInfo.AssetFileNameIsOk(tb.Text))
            {
                errorProvider1.SetError(tb, AMSExplorer.Properties.Resources.ImportHttp_textBoxAssetFileName_TextChanged_AssetFileNameIsNotCompatibleWithMediaServices);
            }
            else
            {
                errorProvider1.SetError(tb, String.Empty);
            }
        }
Ejemplo n.º 3
0
        public BatchUploadFrame2(string BatchFolderPath, bool BatchProcessFiles, bool BatchProcessSubFolders, CloudMediaContext context)
        {
            InitializeComponent();
            this.Icon = Bitmaps.Azure_Explorer_ico;
            _context  = context;

            folders = Directory.GetDirectories(BatchFolderPath).ToList();
            files   = Directory.GetFiles(BatchFolderPath).ToList();

            try
            {
                if (BatchProcessFiles)
                {
                    foreach (var file in files)
                    {
                        var it = checkedListBoxFiles.Items.Add(Path.GetFileName(file));
                        it.Checked = true;
                        if (!AssetInfo.AssetFileNameIsOk(Path.GetFileName(file)))
                        {
                            it.ForeColor = Color.Red;
                        }
                    }
                }
                if (BatchProcessSubFolders)
                {
                    folders.RemoveAll(f => Directory.GetFiles(f).Count() == 0); // we remove all folder with 0 file in it at the root

                    string s;
                    int    filecount;
                    foreach (var folder in folders)
                    {
                        filecount = Directory.GetFiles(folder).Count();
                        s         = filecount > 1 ? AMSExplorer.Properties.Resources.BatchUploadFrame2_BatchUploadFrame2_01Files : AMSExplorer.Properties.Resources.BatchUploadFrame2_BatchUploadFrame2_01File;
                        var it = checkedListBoxFolders.Items.Add(string.Format(s, Path.GetFileName(folder), filecount));
                        it.Checked = true;
                        if (AssetInfo.ReturnFilenamesWithProblem(Directory.GetFiles(folder).ToList()).Count > 0)
                        {
                            it.ForeColor = Color.Red;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ErrorConnect      = true;
                this.DialogResult = DialogResult.None;
                MessageBox.Show(AMSExplorer.Properties.Resources.BatchUploadFrame2_BatchUploadFrame2_ErrorWhenReadingFilesOrFolders + Constants.endline + e.Message, AMSExplorer.Properties.Resources.AMSLogin_buttonExport_Click_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }