Example #1
0
        /// <summary>
        /// Creates an instance of ToolLanguageForm and show
        /// </summary>
        /// <param name="owner">modal owner</param>
        /// <param name="language">edit language</param>
        /// <returns>contains unsaved changes</returns>
        internal static bool ShowForm(IWin32Window owner, ToolLanguage language)
        {
            ToolLanguageForm dlg = new ToolLanguageForm(language);

            dlg.ShowDialog(owner);
            dlg.Dispose(true);
            return(dlg.Changed);
        }
        private void treeGridView1_SelectionChanged(object sender, EventArgs e)
        {
            RaiseSelectionChanged();
            Clear();
            if(null == _owner)
                _owner = FindOwner(this);
            _owner.StopHighLightControl1();
            _lastHightlight = null;
           
            if (treeGridView1.SelectedCells.Count > 0)
            {
                int index = treeGridView1.SelectedCells[0].RowIndex;
                TreeGridNode node = treeGridView1.Rows[index] as TreeGridNode;
                
                LocalizableCompoment component;
                component = node.Tag as LocalizableCompoment;
                if (null == component)
                {
                    if (null != (node.Parent.Tag as LocalizableCompoment))
                    {
                        string ctrlName = (node.Tag as NotifyPropertyChanged).Value;
                        if (!ctrlName.Equals("this", StringComparison.InvariantCulture))
                        { 
                            Control ctrl = Translator.TryGetControl((node.Parent.Tag as LocalizableCompoment).Design, (node.Tag as NotifyPropertyChanged).Value);
                            if (null != ctrl && tabControl1.SelectedIndex == 0)
                            {
                                _owner.StartHighLightControl1(ctrl);
                                _lastHightlight = ctrl;
                            }
                            else
                            {
                                _owner.StopHighLightControl1();
                                _lastHightlight = null;
                            }
                        }
                    }

                    component = node.Parent.Tag as LocalizableCompoment;
                    ShowStringEditor(component, node.Tag as NotifyPropertyChanged);
                }
                else
                    ShowStringEditor(null, node.Tag as NotifyPropertyChanged);

                if (null != component)
                {
                    ILocalizationDesign design = component.Design as ILocalizationDesign;
                    if (null != design)
                    {
                        design.Localize(component.ControlRessources);
                    }

                    tabPage1.Controls.Add(component.Design);
                    component.Design.Dock = DockStyle.Fill;
                    EnableInput(component.Design, false);
                }
            }
        }
 private void dataGridView1_DoubleClick(object sender, EventArgs e)
 {
     if (null != Selected)
     {
         bool b = ToolLanguageForm.ShowForm(this, Selected);
         if (b)
         {
             RaiseLanguageChanged(Selected.LCID);
         }
     }
 }
        private ToolLanguageForm FindOwner(Control ctrl)
        {
            if (null == ctrl)
                return null;

            if (ctrl.Parent is ToolLanguageForm)
                return ctrl.Parent as ToolLanguageForm;
            else
            {
                ToolLanguageForm p = FindOwner(ctrl.Parent);
                return p;
            }
        }
        private ToolLanguageForm FindOwner(Control ctrl)
        {
            if (null == ctrl)
            {
                return(null);
            }

            if (ctrl.Parent is ToolLanguageForm)
            {
                return(ctrl.Parent as ToolLanguageForm);
            }
            else
            {
                ToolLanguageForm p = FindOwner(ctrl.Parent);
                return(p);
            }
        }
Example #6
0
 /// <summary>
 /// Creates an instance of ToolLanguageForm and show
 /// </summary>
 /// <param name="owner">modal owner</param>
 /// <param name="language">edit language</param>
 /// <returns>contains unsaved changes</returns>
 internal static bool ShowForm(IWin32Window owner, ToolLanguage language)
 {
     ToolLanguageForm dlg = new ToolLanguageForm(language);
     dlg.ShowDialog(owner);
     dlg.Dispose(true);
     return dlg.Changed;
 }
        private void treeGridView1_SelectionChanged(object sender, EventArgs e)
        {
            RaiseSelectionChanged();
            Clear();
            if(null == _owner)
                _owner = FindOwner(this);
            _owner.StopHighLightControl2();
            _lastHightlight = null;

            if (treeGridView1.SelectedCells.Count > 0)
            {
                int index = treeGridView1.SelectedCells[0].RowIndex;
                TreeGridNode node = treeGridView1.Rows[index] as TreeGridNode;

                LocalizableCompoment component;
                component = node.Tag as LocalizableCompoment;
                if (null == component)
                {
                    if (null != (node.Parent.Tag as LocalizableCompoment))
                    {
                        string ctrlName = (node.Tag as NotifyPropertyChanged).Value;
                        if (!ctrlName.Equals("this", StringComparison.InvariantCulture))
                        {
                            Control ctrl = Translator.TryGetControl((node.Parent.Tag as LocalizableCompoment).Design, (node.Tag as NotifyPropertyChanged).Value);
                            if (null != ctrl && tabControl1.SelectedIndex == 0)
                            {
                                _owner.StartHighLightControl2(ctrl);
                                _lastHightlight = ctrl;
                            }
                            else
                            {
                                _owner.StopHighLightControl2();
                                _lastHightlight = null;
                            }
                        }
                    }

                    component = node.Parent.Tag as LocalizableCompoment;
                    ShowStringEditor(component, node.Tag as NotifyPropertyChanged);
                }
                else
                    ShowStringEditor(null, node.Tag as NotifyPropertyChanged);

                if (null != component)
                {
                    ILocalizationDesign design = component.Design as ILocalizationDesign;
                    if (null != design)
                    {
                        design.Localize(component.ControlRessources);
                    }

                    tabPage1.Controls.Add(component.Design);
                    component.Design.Dock = DockStyle.Fill;
                    component.Design.Visible = true;
                    EnableInput(component.Design, false);
                }
            }
        }