Пример #1
0
        /// <summary>
        /// 依赖项属性发生改变时,触发的事件:
        /// 当SoundProperty依赖项属性,的属性值发生改变的时候,调用这个方法
        /// </summary>
        /// <param name="sender">依赖项对象</param>
        /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param>
        private static void OnSoundChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //如果值发生改变了
            if ((bool)e.OldValue != (bool)e.NewValue)
            {
                //获取控件
                SettingsUiControl _settingsUiControl = sender as SettingsUiControl;

                //判断
                switch ((bool)e.NewValue)
                {
                //如果值为[开]
                case true:
                    //修改CheckGroup
                    _settingsUiControl.EnSoundCheckGroup.CheckedIndex = 0;
                    _settingsUiControl.CnSoundCheckGroup.CheckedIndex = 0;
                    break;

                //如果值为[关]
                case false:
                    //修改CheckGroup
                    _settingsUiControl.EnSoundCheckGroup.CheckedIndex = 1;
                    _settingsUiControl.CnSoundCheckGroup.CheckedIndex = 1;
                    break;
                }

                //触发事件
                _settingsUiControl.OnSoundChange((bool)e.NewValue);
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.SettingsUiUserControl = ((EasyBugManagerTool.SettingsUiControl)(target));
                return;

            case 2:
                this.BackgroundBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.StaffGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.CnStackPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 5:
                this.CnLanguageCheckGroup = ((EasyBugManagerTool.ImageCheckGroupControl)(target));
                return;

            case 6:
                this.CnSoundCheckGroup = ((EasyBugManagerTool.ImageCheckGroupControl)(target));
                return;

            case 7:
                this.EnStackPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 8:
                this.EnLanguageCheckGroup = ((EasyBugManagerTool.ImageCheckGroupControl)(target));
                return;

            case 9:
                this.EnSoundCheckGroup = ((EasyBugManagerTool.ImageCheckGroupControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 21 "..\..\MainWindow.xaml"
                ((EasyBugManagerTool.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.MainWindow_OnLoaded);

            #line default
            #line hidden
                return;

            case 2:
                this.MainUiControl = ((EasyBugManagerTool.MainUiControl)(target));
                return;

            case 3:
                this.SettingsUiControl = ((EasyBugManagerTool.SettingsUiControl)(target));
                return;

            case 4:
                this.ConvertUiControl = ((EasyBugManagerTool.ConvertUiControl)(target));
                return;

            case 5:
                this.RepairUiControl = ((EasyBugManagerTool.BrowseUiControl)(target));
                return;

            case 6:
                this.BrowseUiControl = ((EasyBugManagerTool.BrowseUiControl)(target));
                return;

            case 7:
                this.TipUiControl = ((EasyBugManagerTool.TipUiControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
Пример #4
0
        /// <summary>
        /// 依赖项属性发生改变时,触发的事件:
        /// 当LanguageProperty依赖项属性,的属性值发生改变的时候,调用这个方法
        /// </summary>
        /// <param name="sender">依赖项对象</param>
        /// <param name="e">依赖项属性改变事件 的参数(里面有这个属性的新的值,和旧的值)</param>
        private static void OnLanguageChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            //如果值发生改变了
            if ((LanguageType)e.OldValue != (LanguageType)e.NewValue)
            {
                //获取控件
                SettingsUiControl _settingsUiControl = sender as SettingsUiControl;

                //判断
                switch ((LanguageType)e.NewValue)
                {
                //如果值为[英文]
                case LanguageType.English:
                    //打开英语面板,关闭中文面板
                    _settingsUiControl.EnStackPanel.Visibility = Visibility.Visible;
                    _settingsUiControl.CnStackPanel.Visibility = Visibility.Collapsed;
                    //修改CheckGroup
                    _settingsUiControl.EnLanguageCheckGroup.CheckedIndex = 0;
                    _settingsUiControl.CnLanguageCheckGroup.CheckedIndex = 0;
                    break;

                //如果值为[中文]
                case LanguageType.Chinese:
                    //打开中文面板,关闭英文面板
                    _settingsUiControl.EnStackPanel.Visibility = Visibility.Collapsed;
                    _settingsUiControl.CnStackPanel.Visibility = Visibility.Visible;
                    //修改CheckGroup
                    _settingsUiControl.EnLanguageCheckGroup.CheckedIndex = 1;
                    _settingsUiControl.CnLanguageCheckGroup.CheckedIndex = 1;
                    break;
                }

                //触发事件
                _settingsUiControl.OnLanguageChange((LanguageType)e.NewValue);
            }
        }