Exemplo n.º 1
0
        public override void Init()
        {
            appPath       = Path.Combine("Apps", "RemotePlayer");
            currentWindow = new XingKongWindow();
            XingKongWindow.Entity entity = JsonConvert.DeserializeObject <XingKongWindow.Entity>(File.ReadAllText(Path.Combine(this.appPath, "RemotePlayerForm.json")));
            currentWindow.SetEntity(entity);
            pbAlbum      = currentWindow.ControlsSet["pbAlbum"] as XingKongImageBox;
            lbNowPlaying = currentWindow.ControlsSet["lbNowPlaying"] as XingKongLabel;
            lbName       = currentWindow.ControlsSet["lbName"] as XingKongLabel;
            lbSinger     = currentWindow.ControlsSet["lbSinger"] as XingKongLabel;
            lbAlbum      = currentWindow.ControlsSet["lbAlbum"] as XingKongLabel;
            lbExit       = currentWindow.ControlsSet["lbExit"] as XingKongLabel;

            lbName.Text   = "暂无信息";
            lbSinger.Text = "暂无信息";
            lbAlbum.Text  = "暂无信息";

            //pbAlbum.SkipPreProceed = true;
            defaultAlubmPath = Path.Combine(appPath, "album.png");
            pbAlbum.LoadPicture(defaultAlubmPath);

            XingKongScreen.ClearScreen();
            currentWindow.HardworkDraw();
            XingKongScreen.FreshScreen();

            keyboard                      = XingKongScreen.GetKeyboard();
            keyboard.KeyPressed          += new Keyboard.KeyPressedHandler(Keyboard_KeyPressed);
            tcpListener                   = new TcpListener();
            tcpListener.MusicInfoReceived = MusicInfoReceived;
            tcpListener.Start();
        }
Exemplo n.º 2
0
        public override void Init()
        {
            appPath              = Path.Combine("Apps", "Kuaidi");
            keyboard             = XingKongScreen.GetKeyboard();
            keyboard.KeyPressed += new Keyboard.KeyPressedHandler(Keyboard_KeyPressed);

            LogData("1");

            mainWindow = new XingKongWindow();
            XingKongWindow.Entity entity = JsonConvert.DeserializeObject <XingKongWindow.Entity>(File.ReadAllText(Path.Combine(appPath, "KuaidiMainForm.json")));
            mainWindow.SetEntity(entity);
            lbTitle   = mainWindow.ControlsSet["lbTitle"] as XingKongLabel;
            lbKuaidis = mainWindow.ControlsSet["lbKuaidis"] as XingKongListBox;

            ShowMainWindow();
            LogData("2");

            kuaidiInfoWindow = new XingKongWindow();
            XingKongWindow.Entity entity2 = JsonConvert.DeserializeObject <XingKongWindow.Entity>(File.ReadAllText(Path.Combine(appPath, "KuaidiInfoForm.json")));
            kuaidiInfoWindow.SetEntity(entity2);
            g1           = new KuaidiInfoFormControlGroup(kuaidiInfoWindow, 1);
            g2           = new KuaidiInfoFormControlGroup(kuaidiInfoWindow, 2);
            g3           = new KuaidiInfoFormControlGroup(kuaidiInfoWindow, 3);
            g4           = new KuaidiInfoFormControlGroup(kuaidiInfoWindow, 4);
            infoGroup[0] = g1;
            infoGroup[1] = g2;
            infoGroup[2] = g3;
            infoGroup[3] = g4;
            lbg1g2       = kuaidiInfoWindow.ControlsSet["lbg1g2"] as XingKongLabel;
            lbg2g3       = kuaidiInfoWindow.ControlsSet["lbg2g3"] as XingKongLabel;
            lbg3g4       = kuaidiInfoWindow.ControlsSet["lbg3g4"] as XingKongLabel;
            lbInfoTitle  = kuaidiInfoWindow.ControlsSet["lbInfoTitle"] as XingKongLabel;

            LogData("Controls Reference Load Completed!");
        }
Exemplo n.º 3
0
        public void Init()
        {
            thisWindow = new XingKongWindow();
            string shutdownWindowJson = File.ReadAllText(@"AppForm.json");

            XingKongWindow.Entity windowEntity = JsonConvert.DeserializeObject <XingKongWindow.Entity>(shutdownWindowJson);
            thisWindow.SetEntity(windowEntity);

            btLaunch  = thisWindow.ControlsSet["btLaunch"] as XingKongButton;
            btBack    = thisWindow.ControlsSet["btBack"] as XingKongButton;
            pbIcon    = thisWindow.ControlsSet["pbIcon"] as XingKongImageBox;
            lbAllApps = thisWindow.ControlsSet["lbAllApps"] as XingKongLabel;
            lbApps    = thisWindow.ControlsSet["lbApps"] as XingKongListBox;

            lbApps.Refresh();

            pbIcon.SkipPreProceed = true;
            pbIcon.LoadPicture(Path.Combine("SystemUI", "appstore.png"));

            apps = AppFinder.GetAppList();
            if ((apps == null) || (apps.Count == 0))
            {
                XingKongMessageBox box1 = new XingKongMessageBox
                {
                    Caption = "提示",
                    Title   = "然而一个应用都没有。"
                };
                box1.btOk.IsChecked = true;
                box1.DialogStyle    = XingKongMessageBox.Style.OK;
                Console.WriteLine("user clicked: " + box1.ShowAsync().Result);
            }
            else
            {
                if (lbApps.Items == null)
                {
                    lbApps.Items = new List <string>();
                }
                foreach (AppInfo info in apps)
                {
                    lbApps.Items.Add(info.AppName);
                }
                lbApps.Refresh();
            }
            XingKongScreen.ClearScreen();
            thisWindow.HardworkDraw();
            XingKongScreen.FreshScreen();
            keyboard             = XingKongScreen.GetKeyboard();
            keyboard.KeyPressed += new Keyboard.KeyPressedHandler(Keyboard_KeyPressed);
        }
Exemplo n.º 4
0
 public override void Init()
 {
     appPath       = Path.Combine("Apps", "PhotoLibrary");
     currentWindow = new XingKongWindow();
     XingKongWindow.Entity entity = JsonConvert.DeserializeObject <XingKongWindow.Entity>(File.ReadAllText(Path.Combine(this.appPath, "MainForm.json")));
     currentWindow.SetEntity(entity);
     lbHint          = this.currentWindow.ControlsSet["lbHint"] as XingKongLabel;
     lbCaption       = this.currentWindow.ControlsSet["lbCaption"] as XingKongLabel;
     lbPicList       = this.currentWindow.ControlsSet["lbPicList"] as XingKongListBox;
     lbPicList.Items = this.GetPicFileNames();
     lbPicList.Refresh();
     keyboard             = XingKongScreen.GetKeyboard();
     keyboard.KeyPressed += new Keyboard.KeyPressedHandler(this.Keyboard_KeyPressed);
     XingKongScreen.ClearScreen();
     currentWindow.HardworkDraw();
     XingKongScreen.FreshScreen();
 }
Exemplo n.º 5
0
        public override void Init()
        {
            appPath       = Path.Combine("Apps", "TpLinkNetMonitor");
            currentWindow = new XingKongWindow();
            XingKongWindow.Entity entity = JsonConvert.DeserializeObject <XingKongWindow.Entity>(File.ReadAllText(Path.Combine(this.appPath, "MainForm.json")));
            currentWindow.SetEntity(entity);

            XingKongPanel plGlobal = currentWindow.ControlsSet["plGlobal"] as XingKongPanel;

            lbGlobalDownload = plGlobal.ControlsSet["lbGlobalDownload"] as XingKongLabel;
            lbGlobalUpload   = plGlobal.ControlsSet["lbGlobalUpload"] as XingKongLabel;

            XingKongPanel plArea0 = currentWindow.ControlsSet["plArea0"] as XingKongPanel;

            lbArea0PcName = plArea0.ControlsSet["lbArea0PcName"] as XingKongLabel;
            lbArea0Ip     = plArea0.ControlsSet["lbArea0Ip"] as XingKongLabel;
            lbArea0Up     = plArea0.ControlsSet["lbArea0Up"] as XingKongLabel;
            lbArea0Down   = plArea0.ControlsSet["lbArea0Down"] as XingKongLabel;

            XingKongPanel plArea1 = currentWindow.ControlsSet["plArea1"] as XingKongPanel;

            lbArea1PcName = plArea1.ControlsSet["lbArea1PcName"] as XingKongLabel;
            lbArea1Ip     = plArea1.ControlsSet["lbArea1Ip"] as XingKongLabel;
            lbArea1Up     = plArea1.ControlsSet["lbArea1Up"] as XingKongLabel;
            lbArea1Down   = plArea1.ControlsSet["lbArea1Down"] as XingKongLabel;

            XingKongPanel plArea2 = currentWindow.ControlsSet["plArea2"] as XingKongPanel;

            lbArea2PcName = plArea2.ControlsSet["lbArea2PcName"] as XingKongLabel;
            lbArea2Ip     = plArea2.ControlsSet["lbArea2Ip"] as XingKongLabel;
            lbArea2Up     = plArea2.ControlsSet["lbArea2Up"] as XingKongLabel;
            lbArea2Down   = plArea2.ControlsSet["lbArea2Down"] as XingKongLabel;

            XingKongPanel plArea3 = currentWindow.ControlsSet["plArea3"] as XingKongPanel;

            lbArea3PcName = plArea3.ControlsSet["lbArea3PcName"] as XingKongLabel;
            lbArea3Ip     = plArea3.ControlsSet["lbArea3Ip"] as XingKongLabel;
            lbArea3Up     = plArea3.ControlsSet["lbArea3Up"] as XingKongLabel;
            lbArea3Down   = plArea3.ControlsSet["lbArea3Down"] as XingKongLabel;

            XingKongPanel plPage = currentWindow.ControlsSet["plPage"] as XingKongPanel;

            lbPage = plPage.ControlsSet["lbPage"] as XingKongLabel;
            btPrev = currentWindow.ControlsSet["btPrev"] as XingKongButton;
            btNext = currentWindow.ControlsSet["btNext"] as XingKongButton;

            //显示初始内容
            lbGlobalDownload.Text = "下载:N/A";
            lbGlobalUpload.Text   = "上传:N/A";
            for (int i = 0; i < 4; i++)
            {
                setAreaContent(i, null);
            }
            lbPage.Text = "退出:Esc";

            pageManager = new PageManager();

            XingKongScreen.ClearScreen();
            currentWindow.HardworkDraw();
            XingKongScreen.FreshScreen();

            //登陆并启动定时刷新计时器
            if (Login(out token))
            {
                LogData("登陆成功,token:" + token);

                request_url = string.Format("http://192.168.0.1/stok={0}/ds", token);

                if (timer == null)
                {
                    timer          = new System.Timers.Timer();
                    timer.Interval = 1000;
                    timer.Elapsed += Timer_Elapsed;
                    timer.Start();
                }
            }
            else
            {
                LogData("登陆失败");
                XingKongMessageBox msgBox = new XingKongMessageBox();
                msgBox.Title       = "登陆TP-Link后台失败";
                msgBox.Caption     = "提示";
                msgBox.DialogStyle = XingKongMessageBox.Style.OK;
                XingKongMessageBox.DialogResult result = msgBox.ShowAsync().Result;
                LogData("user click : " + result.ToString());
                Quit();
            }

            keyboard             = XingKongScreen.GetKeyboard();
            keyboard.KeyPressed += new Keyboard.KeyPressedHandler(this.Keyboard_KeyPressed);
        }
Exemplo n.º 6
0
        public override void Init()
        {
            //先显示启动画面
            showStartingInterface();

            if (!XingKongScreen.IsRunningOnMono())
            {
                Thread.Sleep(1000);
            }

            string appLoaderWindowJson = File.ReadAllText(@"MainForm.json");

            XingKongWindow.Entity windowEntity = JsonConvert.DeserializeObject <XingKongWindow.Entity>(appLoaderWindowJson);
            currentForm = new XingKongWindow();
            currentForm.SetEntity(windowEntity);

            #region 初始化日期控件
            XingKongPanel panel1 = currentForm.ControlsSet["panel1"] as XingKongPanel;
            lbWeek = panel1.ControlsSet["lbWeek"] as XingKongLabel;
            lbDate = panel1.ControlsSet["lbDate"] as XingKongLabel;
            pbM1   = currentForm.ControlsSet["pbM1"] as XingKongImageBox;
            pbM2   = currentForm.ControlsSet["pbM2"] as XingKongImageBox;
            pbS    = currentForm.ControlsSet["pbS"] as XingKongImageBox;
            pbH1   = currentForm.ControlsSet["pbH1"] as XingKongImageBox;
            pbH2   = currentForm.ControlsSet["pbH2"] as XingKongImageBox;

            pbM1.SkipPreProceed = true;
            pbM2.SkipPreProceed = true;
            pbS.SkipPreProceed  = true;
            pbH1.SkipPreProceed = true;
            pbH2.SkipPreProceed = true;

            pbS.LoadPicture(getNumPic(':'));
            #endregion

            #region 初始化天气控件
            XingKongPanel panel2 = currentForm.ControlsSet["panel2"] as XingKongPanel;
            XingKongPanel panel3 = currentForm.ControlsSet["panel3"] as XingKongPanel;
            pbWeatherIcon  = currentForm.ControlsSet["pbWeatherIcon"] as XingKongImageBox;
            lbCity         = panel2.ControlsSet["lbCity"] as XingKongLabel;
            lbWeather      = panel2.ControlsSet["lbWeather"] as XingKongLabel;
            lbTemp         = panel2.ControlsSet["lbTemp"] as XingKongLabel;
            lbWind         = panel2.ControlsSet["lbWind"] as XingKongLabel;
            lbTempCurrDesc = panel3.ControlsSet["lbTempCurrDesc"] as XingKongLabel;
            lbTempCurr     = panel3.ControlsSet["lbTempCurr"] as XingKongLabel;

            pbWeatherIcon.SkipPreProceed = true;

            lbTomoWeatherAndWind = panel2.ControlsSet["lbTomoWeatherAndWind"] as XingKongLabel;
            lbTomoTemp           = panel2.ControlsSet["lbTomoTemp"] as XingKongLabel;
            #endregion

            #region 初始化系统信息控件
            XingKongPanel panel4 = currentForm.ControlsSet["panel4"] as XingKongPanel;
            lbIp        = panel4.ControlsSet["lbIp"] as XingKongLabel;
            lbCpuStatus = panel4.ControlsSet["lbCpuStatus"] as XingKongLabel;
            lbRamStatus = panel4.ControlsSet["lbRamStatus"] as XingKongLabel;
            #endregion

            #region 初始化按钮控件
            pbPower = currentForm.ControlsSet["pbPower"] as XingKongImageBox;
            pbApp   = currentForm.ControlsSet["pbApp"] as XingKongImageBox;
            btPower = currentForm.ControlsSet["btPower"] as XingKongButton;
            btApp   = currentForm.ControlsSet["btApp"] as XingKongButton;

            pbPower.SkipPreProceed = true;
            pbApp.SkipPreProceed   = true;

            pbPower.LoadPicture(Path.Combine("SystemUI", "POWER.BMP"));
            pbApp.LoadPicture(Path.Combine("SystemUI", "APP.BMP"));
            if (XingKongScreen.IsRunningOnMono())
            {
                btPower.TextXoffset = -9;
                btApp.TextXoffset   = -9;
            }
            else
            {
                btPower.TextXoffset = -2;
                btApp.TextXoffset   = -2;
            }
            #endregion

            UpdateIp();
            UpdateTime();
            UpdateSystemInfo();
            UpdateWeather();
            currentForm.HardworkDraw();

            XingKongScreen.FreshScreen();

            keyboard             = XingKongScreen.GetKeyboard();
            keyboard.KeyPressed += Keyboard_KeyPressed;

            autoSyncMiniuteTimer          = new System.Timers.Timer();//同步时钟间隔
            autoSyncMiniuteTimer.Elapsed += AutoSyncMiniuteTimer_Elapsed;
            SyncMiniuteTimer();

            autoFreshTimer          = new System.Timers.Timer();
            autoFreshTimer.Interval = 1000 * 60;//一分钟刷新一次
            autoFreshTimer.Elapsed += AutoFreshTimer_Elapsed;

            autoWeatherTimer          = new System.Timers.Timer();
            autoWeatherTimer.Interval = 1000 * 60 * 10;//十分钟刷新一次
            autoWeatherTimer.Elapsed += AutoWeatherTimer_Elapsed;
            autoWeatherTimer.Enabled  = true;
        }