Beispiel #1
0
        public void SaveFile(string fname)
        {
            List <JControlOutputData> lst = new List <JControlOutputData>();

            foreach (var c in stage.AllControls)
            {
                JWCControl jc = c as JWCControl;
                if (jc == null)
                {
                    continue;
                }
                lst.Add(jc.OutputProperty());
            }

            JWCSaveFile file = new JWCSaveFile();

            file.Width         = (int)stage.MainStage.Width;
            file.Height        = (int)stage.MainStage.Height;
            file.AllControls   = lst;
            file.BgUsePic      = stage.BgUsePic;
            file.BackGroundPic = stage.BgFilename;
            Color cl = stage.BgColor;

            file.BackColor = new byte[4] {
                cl.A, cl.R, cl.G, cl.B
            };

            file.Communicator = commu;
            file.ComAdapter   = adapter;
            file.ComName      = ComFname;
            file.AdaName      = AdaFname;

            file.Version = Assembly.GetExecutingAssembly().GetName().Version;

            JWCSerializer <JWCSaveFile> jse = new JWCSerializer <JWCSaveFile>();

            jse.Serialize(file, fname);
        }
Beispiel #2
0
        private void ColorButton_Click(object sender, RoutedEventArgs e)
        {
            //setline1 = ((SolidColorBrush)((Rectangle)(sender as RadioButton).Content).Fill).Color;//要获得所选方块的颜色,需要将SolidColorBrush取Color
            if ((sender as RadioButton).Tag.ToString() == "1")
            {
                XXControl xx = new XXControl();
                xx.Margin = new Thickness(0, 0, 0, 0);
                xx.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                xx.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                xx.ShowPic             = true;
                xx.Width      = 350;
                xx.Height     = 350;
                xx.IsEditMode = true;
                xx.ZIndex     = 6;
                xx.Name       = "WC1";
                stage.AddControl(xx);
            }
            else if ((sender as RadioButton).Tag.ToString() == "2")
            {
                XXControl xx = new XXControl();
                xx.Margin = new Thickness(0, 0, 0, 0);
                xx.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                xx.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                xx.ShowPic             = true;
                xx.Width      = 150;
                xx.Height     = 150;
                xx.IsEditMode = true;
                xx.ZIndex     = 15;

                tempxx = xx;
            }
            else if ((sender as RadioButton).Tag.ToString() == "3")
            {
                XXControl xx = new XXControl();
                xx.ShowPic   = false;
                xx.ZIndex    = 33;
                xx.ForeColor = Colors.Pink;
                JControlOutputData dic = xx.OutputProperty();
                MessageBox.Show(dic["ForeColor"].ToString());

                JWCSerializer <JControlOutputData> ss = new JWCSerializer <JControlOutputData>();
                tempdata = ss.Serialize(dic);
            }
            else if ((sender as RadioButton).Tag.ToString() == "4")
            {
                JWCSerializer <JControlOutputData> ss = new JWCSerializer <JControlOutputData>();
                JControlOutputData oo = ss.Deserialize(tempdata);
                XXControl          xx = new XXControl();
                xx.InputProperty(oo);
                MessageBox.Show(xx.ForeColor.ToString());
                xx.Margin = new Thickness(0, 0, 0, 0);
                xx.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                xx.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                xx.Width      = 150;
                xx.Height     = 150;
                xx.IsEditMode = true;
                stage.AddControl(xx);
            }
            else if ((sender as RadioButton).Tag.ToString() == "5")
            {
                JWCControl xx = JWCControlFactory.CreateInstance("NanjingControls.DunWei");
                xx.Parent = grid_main;
                xx.Margin = new Thickness(0, 0, 0, 0);
                xx.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                xx.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
                //xx.ShowPic = true;
                //xx.Width = 350;
                //xx.Height = 350;
                xx.IsEditMode = true;
                xx.ZIndex     = 6;
                stage.AddControl(xx);
            }
            else if ((sender as RadioButton).Tag.ToString() == "6")
            {
            }
        }