Exemplo n.º 1
0
        /// <summary>
        /// 初始化加载
        /// </summary>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //关闭图片
            img.Source = new BitmapImage(new Uri(BLL.DataFetch.Path + "Resources/Close_click.png"));
            HwndSource          hWndSource, hPause, hBeginAndEnd;
            WindowInteropHelper wih = new WindowInteropHelper(this);

            hWndSource   = HwndSource.FromHwnd(wih.Handle);
            hPause       = HwndSource.FromHwnd(wih.Handle);
            hBeginAndEnd = HwndSource.FromHwnd(wih.Handle);
            //添加处理程序
            hWndSource.AddHook(MainWindowProc);
            hPause.AddHook(MainWindowProc);
            hBeginAndEnd.AddHook(MainWindowProc);
            Identification = HotKey.GlobalAddAtom("Alt-D");
            //暂停播放
            Pause = HotKey.GlobalAddAtom("Alt-Q");
            //停止开始
            BeginAndEnd = HotKey.GlobalAddAtom("Alt-W");

            HotKey.RegisterHotKey(wih.Handle, Identification, HotKey.KeyModifiers.Alt, (int)System.Windows.Forms.Keys.D);
            HotKey.RegisterHotKey(wih.Handle, Pause, HotKey.KeyModifiers.Alt, (int)System.Windows.Forms.Keys.Q);
            HotKey.RegisterHotKey(wih.Handle, BeginAndEnd, HotKey.KeyModifiers.Alt, (int)System.Windows.Forms.Keys.W);

            //判断配置项是否为null
            if (config == null)
            {
                config = ConfigReadWrite.GetConfig();
            }
            //记载配置项
            LoadConfiguration();
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            string path = AppDomain.CurrentDomain.BaseDirectory;

            //this.Icon = BitmapFrame.Create(new Uri(path + "Resources/favicon.ico"));

            //获取配置项
            config = ConfigReadWrite.GetConfig();

            about.Text = "本软件只是娱乐之作,所有数据来源皆来自于网络,如果有侵犯到他人的权益,请于我进行联系,我会第一时间删除源站,谢谢合作!\n\n本软件默认有两个源:笔趣阁、追书网,用户可以自定义增加更多的源站,如果你有更好的源站,可以推荐给我,我会第一时间集成进去。\n\n本软件初始发布于吾爱破解,如果你在使用的过程中有发现BUG或者其他不合理的地方,请进行留言。本软件只作用于学习研究,请在下载内24小时内删除本软件。";

            //字体
            Typeface.ItemsSource = Tool.GetTypeface();
            Typeface.Text        = config.Typeface;

            //绑定字体大小
            TypefaceSize.ItemsSource = config.GetTypefaceSize;
            TypefaceSize.Text        = config.FontSize.ToString();

            //绑定主题
            theme.ItemsSource = config.GetTheme;
            theme.Text        = config.Theme;

            //刷新数据
            RefreshData();

            //绑定书源
            SourceStation.ItemsSource = lb;
            SourceStation.Text        = config.SourceStation;

            //禁用养肥区
            fatten.IsEnabled = false;
        }
Exemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            //190731增加,这里新增加一个判断,判断是否存在指定列,如果不存在将进行增加列操作
            if (!DataFetch.ColumnExistence("BookSource", "Code"))
            {
                SQLiteDBHelper.ExecuteDataTable("ALTER TABLE BookSource ADD COLUMN Code Text; ", null);
            }

            string path = AppDomain.CurrentDomain.BaseDirectory;

            //this.Icon = BitmapFrame.Create(new Uri(path + "Resources/favicon.ico"));

            //获取配置项
            config = ConfigReadWrite.GetConfig();

            about.Text = "本软件只是娱乐之作,所有数据来源皆来自于网络,如果有侵犯到他人的权益,请于我进行联系,我会第一时间删除源站,谢谢合作!\n\n本软件默认有五个源,用户可以自定义增加更多的源站,如果你有更好的源站,可以推荐给我,我会第一时间集成进去。\n\n本软件初始发布于吾爱破解,如果你在使用的过程中有发现BUG或者其他不合理的地方,请进行留言。本软件只作用于学习研究,请在下载内24小时内删除本软件。";

            //字体
            Typeface.ItemsSource = Tool.GetTypeface();
            Typeface.Text        = config.Typeface;

            //绑定字体大小
            TypefaceSize.ItemsSource = config.GetTypefaceSize;
            TypefaceSize.Text        = config.FontSize.ToString();

            //绑定主题
            theme.ItemsSource = config.GetTheme;
            theme.Text        = config.Theme;

            //更新书源状态
            //DataFetch.UpdateSourceState();

            //刷新数据
            RefreshData();

            //绑定书源
            SourceStation.ItemsSource = lb;
            SourceStation.Text        = config.SourceStation;


            //默认显示养肥区
            FertilizingArea.Visibility = Visibility.Visible;
            fatten.IsEnabled           = true;
            //绑定养肥区
            fatten.ItemsSource = config.GetFattenNumber;
            fatten.Text        = config.FattenNumber.ToString();
            GetFatten();
        }
Exemplo n.º 4
0
        /// <summary>
        /// 构造函数入口
        /// </summary>
        /// <param name="book">书籍信息</param>
        /// <param name="mainWindow">主窗口对象</param>
        /// <param name="config">配置项</param>
        public ReadingPage(Book book, MainWindow mainWindow = null, Config config = null)
        {
            InitializeComponent();
            this.book       = book;
            this.mainWindow = mainWindow;
            this.config     = config;
            //获取目录
            BLL.DataFetch.GetList(book);
            bookSource = BLL.DataFetch.GetBookSource(book.Source);

            //主要为遍历目录
            int i = 0;

            foreach (KeyValuePair <string, string> kvp in book.ListUrl)
            {
                if (kvp.Key.Trim().Length > 2)
                {
                    i++;
                    NewId.Add(i, kvp.Key);
                }
            }

            if (book.Read == 0)
            {
                Jump(1);
            }
            else
            {
                Jump((int)book.Read);
            }

            this.Closed += BeforeClosing;

            config = ConfigReadWrite.GetConfig();
            LoadConfiguration();
            //newText.IsEnabled = false;

            //窗口大小改变时
            this.SizeChanged += new SizeChangedEventHandler(ReadingPage_Resize);

            //设置定时器(朗读)
            timer          = new DispatcherTimer();
            timer.Interval = new TimeSpan(10000000);   //时间间隔为一秒
            timer.Tick    += new EventHandler(timer_Tick);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 构造函数入口
        /// </summary>
        /// <param name="book">书籍信息</param>
        /// <param name="mainWindow">主窗口对象</param>
        /// <param name="config">配置项</param>
        public ReadingPage(Book book, MainWindow mainWindow = null, Config config = null)
        {
            InitializeComponent();
            this.book       = book;
            this.mainWindow = mainWindow;
            this.config     = config;
            //获取目录
            BLL.DataFetch.GetList(book);
            bookSource = BLL.DataFetch.GetBookSource(book.Source);

            //主要为遍历目录
            int i = 0;

            foreach (KeyValuePair <string, string> kvp in book.ListUrl)
            {
                if (kvp.Key.Trim().Length > 2)
                {
                    i++;
                    NewId.Add(i, kvp.Key);
                }
            }

            if (book.Read == 0)
            {
                Jump(1);
            }
            else
            {
                Jump((int)book.Read);
            }

            this.Closed += BeforeClosing;

            config = ConfigReadWrite.GetConfig();
            LoadConfiguration();
            //newText.IsEnabled = false;
        }