Exemplo n.º 1
0
        /// <summary>
        /// 主题保存
        /// </summary>
        private void ThemePreservation(object sender, RoutedEventArgs e)
        {
            switch (((MenuItem)sender).Name)
            {
            case "Default":
            {
                config.Theme = "正常模式";
                break;
            }

            case "Eyehelp":
            {
                config.Theme = "护眼模式";
                break;
            }

            case "Night":
            {
                config.Theme = "黑夜模式";
                break;
            }

            case "transparent":
            {
                config.Theme = "透明模式";
                break;
            }
            }
            LoadConfiguration();
            ConfigReadWrite.SetConfig(config);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 窗口大小改变时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ReadingPage_Resize(object sender, SizeChangedEventArgs e)
        {
            //这里也要实时修改控件所处的相对位置
            img.Margin = new Thickness(this.Width - img.Width - 10, 5, 6, this.Height - img.Height - 5);

            //标题
            newTitle.Margin = new Thickness(10, 5, 0, 0);
            if (this.Width != 470 || this.Height != 650)
            {
                //记忆保存此次设置的大小
                config.Width_height = this.Width + "," + this.Height;
                ConfigReadWrite.SetConfig(config);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 保存配置项
        /// </summary>
        private void SaveConfiguration(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;

            if (comboBox.SelectedItem.ToString().Length > 0)
            {
                var msg = comboBox.SelectedItem;
                switch (comboBox.Name)
                {
                case "Typeface":
                {
                    config.Typeface = msg.ToString();        //about
                    this.FontFamily = new FontFamily(config.Typeface);
                    break;
                }

                case "TypefaceSize":
                {
                    config.FontSize = Convert.ToInt32(msg);
                    break;
                }

                case "theme":
                {
                    config.Theme = msg.ToString();
                    break;
                }

                case "SourceStation":
                {
                    if (msg is BookSource)
                    {
                        config.SourceStation = ((BookSource)msg).Title;
                    }
                    break;
                }

                case "fatten":
                {
                    config.FattenNumber = Convert.ToInt32(msg);
                    break;
                }
                }
                ConfigReadWrite.SetConfig(config);
            }
        }