コード例 #1
0
        /// <summary>
        /// Handles the Click event of the toolStripButtonCreate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void toolStripButtonCreate_Click(object sender, EventArgs e)
        {
            ResourceEditWindow editWindow = null;

            try
            {
                editWindow = new ResourceEditWindow();
                DialogResult result = editWindow.ShowDialog();

                if (result == DialogResult.OK)
                {
                    this.localization.Operations.CreateNewResource(editWindow.ClassName, editWindow.ResourceKey, editWindow.ResourceValue, editWindow.CultureInfo);
                    // this.LoadCultureData();


                    this.backgroundWorker.RunWorkerAsync();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error." + ex.Message);
            }
            finally
            {
                if (editWindow != null)
                {
                    editWindow.Dispose();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Handles the Click event of the toolStripMenuItemNew control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void toolStripMenuItemNew_Click(object sender, EventArgs e)
        {
            ResourceEditWindow editWindow = null;

            try
            {
                editWindow = new ResourceEditWindow();
                editWindow.textBoxCultureInfo.Enabled = false;
                editWindow.textBoxCultureInfo.Text    = this.currentCulture;

                editWindow.textBoxResourceKey.Enabled   = false;
                editWindow.textBoxResourceValue.Enabled = false;

                DialogResult result = editWindow.ShowDialog();

                if (result == DialogResult.OK)
                {
                    this.localization.Operations.CreateNewResource(editWindow.ClassName, editWindow.ResourceKey,
                                                                   editWindow.ResourceValue, this.currentCulture);
                    this.listBox.Items.Add(editWindow.ClassName);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error." + ex.Message);
            }
            finally
            {
                if (editWindow == null)
                {
                    editWindow.Dispose();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Handles the Click event of the buttonNew control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void buttonNew_Click(object sender, EventArgs e)
        {
            ResourceEditWindow editWindow = null;

            try
            {
                //check if we have any classes
                if (this.listBox.Items.Count == 0 || this.currentClassName == string.Empty)
                {
                    MessageBox.Show("No classes found. Please enter a class first", "Newt");
                    return;
                }


                editWindow = new ResourceEditWindow();
                editWindow.textBoxClassName.Text      = this.currentClassName;
                editWindow.textBoxClassName.Enabled   = false;
                editWindow.textBoxCultureInfo.Text    = this.currentCulture;
                editWindow.textBoxCultureInfo.Enabled = false;

                if (editWindow.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    this.localization.Operations.CreateNewResource(this.currentClassName, editWindow.textBoxResourceKey.Text, editWindow.textBoxResourceValue.Text, this.currentCulture);
                    this.RefreshClass();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error." + ex.Message);
            }
            finally
            {
                if (editWindow != null)
                {
                    editWindow.Dispose();
                }
            }
        }