Example #1
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!");
        }
Example #2
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);
        }
Example #3
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();
 }
Example #4
0
        private IDrawable getXingKongControls(object control)
        {
            if (control is Label)
            {
                Label l = control as Label;
                if (l.Visible)
                {
                    XingKongLabel xLabel = new XingKongLabel();
                    xLabel.Name     = l.Name;
                    xLabel.Text     = l.Text;
                    xLabel.Left     = (short)l.Left;
                    xLabel.Top      = (short)l.Top;
                    xLabel.FontSize = (XingKongScreen.XFontSize)getFontSizeIndex(l.Font);
                    return(xLabel);
                }
            }
            else if (control is PictureBox)
            {
                PictureBox p = control as PictureBox;
                if (p.Visible)
                {
                    XingKongImageBox xImage = new XingKongImageBox();
                    xImage.Name = p.Name;
                    xImage.Left = p.Left;
                    xImage.Top  = p.Top;
                    xImage.LoadPicture(new Bitmap(p.Image));
                    xImage.SkipPreProceed = false;
                    return(xImage);
                }
            }
            else if (control is Button)
            {
                Button b = control as Button;
                if (b.Visible)
                {
                    XingKongButton xButton = new XingKongButton();
                    xButton.Name     = b.Name;
                    xButton.FontSize = (XingKongScreen.XFontSize)getFontSizeIndex(b.Font);
                    xButton.Text     = b.Text;
                    xButton.Left     = b.Left;
                    xButton.Top      = b.Top;
                    xButton.Width    = b.Width;
                    xButton.Height   = b.Height;
                    bool   ischekced = false;
                    string tag       = b.Tag as string;
                    if (tag != null && tag.ToLower().Equals("true"))
                    {
                        ischekced = true;
                    }
                    xButton.IsChecked = ischekced;
                    return(xButton);
                }
            }
            else if (control is Panel)
            {
                Panel p = control as Panel;
                if (p.Visible)
                {
                    XingKongPanel xPanel = new XingKongPanel();
                    xPanel.Name   = p.Name;
                    xPanel.Left   = p.Left;
                    xPanel.Top    = p.Top;
                    xPanel.Width  = p.Width;
                    xPanel.Height = p.Height;

                    foreach (Control pcontrol in p.Controls)
                    {
                        IDrawable xkControl = getXingKongControls(pcontrol);
                        if (xkControl != null)
                        {
                            xkControl.setLeft(xkControl.getLeft() + xPanel.Left);
                            xkControl.setTop(xkControl.getTop() + xPanel.Top);
                            xPanel.AddChild(xkControl);
                        }
                    }

                    return(xPanel);
                }
            }
            else if (control is ListBox)
            {
                ListBox l = control as ListBox;
                if (l.Visible)
                {
                    XingKongListBox xListBox = new XingKongListBox();
                    xListBox.setName(l.Name);
                    xListBox.setLeft(l.Left);
                    xListBox.setTop(l.Top);
                    xListBox.Width    = l.Width;
                    xListBox.Height   = l.Height;
                    xListBox.FontSize = (XingKongScreen.XFontSize)getFontSizeIndex(l.Font);
                    List <string> items = new List <string>();
                    foreach (string item in l.Items)
                    {
                        if (item != null)
                        {
                            items.Add(item);
                        }
                    }
                    xListBox.Items         = items;
                    xListBox.SelectedIndex = l.SelectedIndex;
                    return(xListBox);
                }
            }
            return(null);
        }