Exemplo n.º 1
0
        // get available cultures from resx
        private void ProcessAvailableCultures()
        {
            bool flag = false;

            if (this.InvokeRequired)
            {
                bool res    = false;
                var  action = new Action <Form1>(c => res = c.falseTabEnter);
                this.Invoke(action, this);
                flag = res;
            }

            flag = this.falseTabEnter;

            if (flag)
            {
                return;
            }

            ResXOperator fo = new ResXOperator(patterns,
                                               new ResXOperationSettings
            {
                OperationMode = ResXOperationModes.GetAvailableCultures
            },
                                               this.PrintStatus);

            fo.ProcessDirectory(label1.Text);
            foreach (var item in fo.AvailableCultures)
            {
                if (!comboBox1.Items.Contains(item))
                {
                    var itemtoadd = new KeyValuePair <string, string>(item.Key, item.Value);
                    comboBox1.Items.Add(itemtoadd);
                    if (item.Key.ToLower().Equals("default"))
                    {
                        comboBox1.SelectedItem = itemtoadd;
                    }
                }
            }

            if (this.InvokeRequired)
            {
                this.Invoke(new Action <Form1>(c => c.falseTabEnter = true));
            }
            else
            {
                this.falseTabEnter = true;
            }

            EndProcessing(ResXOperationModes.GetAvailableCultures);
        }
Exemplo n.º 2
0
        // synchronize resx
        private void ProcessSync()
        {
            ResXOperator fo = new ResXOperator(patterns,
                                               new ResXOperationSettings
            {
                OperationMode = ResXOperationModes.Synchronize,
                Backup        = checkBox1.Checked,
                AddOnly       = checkBox2.Checked
            },
                                               this.PrintStatus);

            fo.ProcessDirectory(label1.Text);
            EndProcessing(ResXOperationModes.Synchronize);
        }
Exemplo n.º 3
0
        // create package for selected culture
        private void ProcessPackage(object selectedCulture)
        {
            ResXOperator fo = new ResXOperator(patterns,
                                               new ResXOperationSettings
            {
                OperationMode   = ResXOperationModes.CreatePackage,
                SelectedCulture = selectedCulture.ToString()
            },
                                               this.PrintStatus);

            fo.ProcessDirectory(label1.Text);
            zippedPackage = Zipper.ZipFolder(fo.ResXFiles);
            EndProcessing(ResXOperationModes.CreatePackage, selectedCulture.ToString());
        }
Exemplo n.º 4
0
        // save file dialog setup
        private void OpenSaveDialog(string selectedCulture)
        {
            saveFileDlg.FileName = string.Format(EasyResXResources.PackageFormat,
                                                 ResXOperator.GetCultureFromCombo(selectedCulture).ToLower());
            saveFileDlg.InitialDirectory = Environment.GetFolderPath(
                Environment.SpecialFolder.MyDocuments);
            saveFileDlg.DefaultExt = Zipper.ZipDefaultExtension;
            saveFileDlg.Filter     = Zipper.ZipFilter; // throws exception in case of wrong format
            var dlr = saveFileDlg.ShowDialog();

            if (dlr == DialogResult.OK)
            {
                FormCommonUtils.AppendToTextBox(EasyResXResources.CreatePackageOk, textBox1);
            }
        }
Exemplo n.º 5
0
        // create new culture
        private void ProcessNewCulture(object selectedCulture)
        {
            ResXOperator fo = new ResXOperator(patterns,
                                               new ResXOperationSettings
            {
                OperationMode = ResXOperationModes.GetAvailableCultures
            },
                                               this.PrintStatus);

            fo.ProcessDirectory(label1.Text);

            fo.ChangeOperationSettings(
                new ResXOperationSettings
            {
                OperationMode   = ResXOperationModes.CreateNewCulture,
                SelectedCulture = selectedCulture.ToString()
            });

            fo.ProcessDirectory(label1.Text);
            EndProcessing(ResXOperationModes.CreateNewCulture, selectedCulture.ToString());
        }
Exemplo n.º 6
0
        // available cultures to create
        private void tabPage4_Enter(object sender, EventArgs e)
        {
            CheckBeforeStart();
            ProcessAvailableCultures();

            comboBox2.Items.Clear();
            List <string> availableCultures = new List <string>();

            foreach (var availableCulture in comboBox1.Items)
            {
                availableCultures.Add(ResXOperator.GetCultureFromCombo(availableCulture.ToString()));
            }

            foreach (var culture in ResXOperator.GetCulturesList(CultureTypes.FrameworkCultures))
            {
                if (!comboBox2.Items.Contains(culture) && !availableCultures.Contains(culture)) //
                {
                    comboBox2.Items.Add(culture);
                }
            }

            this.falseTabEnter = false;
        }
Exemplo n.º 7
0
        // synchronize resx
        private void ProcessSync()
        {
            ResXOperator fo = new ResXOperator(patterns,
                new ResXOperationSettings
                {
                    OperationMode = ResXOperationModes.Synchronize,
                    Backup = checkBox1.Checked,
                    AddOnly = checkBox2.Checked
                },
                    this.PrintStatus);

            fo.ProcessDirectory(label1.Text);
            EndProcessing(ResXOperationModes.Synchronize);
        }
Exemplo n.º 8
0
 // create package for selected culture
 private void ProcessPackage(object selectedCulture)
 {
     ResXOperator fo = new ResXOperator(patterns,
         new ResXOperationSettings
         {
             OperationMode = ResXOperationModes.CreatePackage,
             SelectedCulture = selectedCulture.ToString()
         },
         this.PrintStatus);
     fo.ProcessDirectory(label1.Text);
     zippedPackage = Zipper.ZipFolder(fo.ResXFiles);
     EndProcessing(ResXOperationModes.CreatePackage, selectedCulture.ToString());
 }
Exemplo n.º 9
0
        // create new culture
        private void ProcessNewCulture(object selectedCulture)
        {
            ResXOperator fo = new ResXOperator(patterns,
                new ResXOperationSettings
                {
                    OperationMode = ResXOperationModes.GetAvailableCultures
                },
                    this.PrintStatus);
            fo.ProcessDirectory(label1.Text);

            fo.ChangeOperationSettings(
                new ResXOperationSettings
                {
                    OperationMode = ResXOperationModes.CreateNewCulture,
                    SelectedCulture = selectedCulture.ToString()
                });

            fo.ProcessDirectory(label1.Text);
            EndProcessing(ResXOperationModes.CreateNewCulture, selectedCulture.ToString());
        }
Exemplo n.º 10
0
        // get available cultures from resx
        private void ProcessAvailableCultures()
        {
            bool flag = false;
            if (this.InvokeRequired)
            {
                bool res = false;
                var action = new Action<Form1>(c => res = c.falseTabEnter);
                this.Invoke(action, this);
                flag = res;
            }

            flag = this.falseTabEnter;

            if(flag)
            {
                return;
            }

            ResXOperator fo = new ResXOperator(patterns,
                new ResXOperationSettings
                {
                    OperationMode = ResXOperationModes.GetAvailableCultures
                },
                    this.PrintStatus);
            fo.ProcessDirectory(label1.Text);
            foreach (var item in fo.AvailableCultures)
            {
                if (!comboBox1.Items.Contains(item))
                {
                    var itemtoadd = new KeyValuePair<string, string>(item.Key, item.Value);
                    comboBox1.Items.Add(itemtoadd);
                    if (item.Key.ToLower().Equals("default"))
                    {
                        comboBox1.SelectedItem = itemtoadd;
                    }
                }
            }

            if (this.InvokeRequired)
            {
                this.Invoke(new Action<Form1>(c => c.falseTabEnter = true));
            }
            else
            {
                this.falseTabEnter = true;
            }

            EndProcessing(ResXOperationModes.GetAvailableCultures);
        }