void fm_OnFinished(JControlOutputData comdata, JControlOutputData adadata, string f1, string f2) { Communicator_Data = comdata; Adapter_Data = adadata; ComFname = f1; AdaFname = f2; }
private void Button_Click(object sender, RoutedEventArgs e) { Communicator_Data = null; Adapter_Data = null; fm_new fm = new fm_new(); fm.OnConfirmNew += (w, h) => { stage.ClearAll(w, h); }; fm.Owner = this; fm.ShowDialog(); }
public void SetData(JControlOutputData comdata, JControlOutputData adadata, string f1, string f2) { if (comdata != null) { Communicator = JWCCommunicatorFactory.CreateCommunicator(f1); Communicator.InputProperty(comdata); } if (adadata != null) { Adapter = JWCCommunicatorFactory.CreateAdapter(f2); Adapter.InputProperty(adadata); } }
public JControlOutputData OutputProperty() { JControlOutputData rst = new JControlOutputData(); PropertyInfo[] pis = this.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); foreach (PropertyInfo pi in pis) { if (Attribute.IsDefined(pi, typeof(OutputableAttribute))) { rst.Add(pi.Name, GetProp(pi)); } } return(rst); }
public void InputProperty(JControlOutputData dic) { PropertyInfo[] pis = this.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); foreach (PropertyInfo pi in pis) { if (Attribute.IsDefined(pi, typeof(OutputableAttribute))) { object val = null; if (dic.ContainsKey(pi.Name)) { val = dic[pi.Name]; SetProp(pi, val); } } } }
private void Button_Click_9(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog op = new System.Windows.Forms.OpenFileDialog(); op.Filter = "JWC工程文件|*.jwc"; System.Windows.Forms.DialogResult dr = op.ShowDialog(); if (dr != System.Windows.Forms.DialogResult.OK) { return; } SLHelper sl = new SLHelper(stage, null, null); sl.LoadFile(op.FileName); Communicator_Data = sl.commu; Adapter_Data = sl.adapter; ComFname = sl.ComFname; AdaFname = sl.AdaFname; }
private void btn_next_Click(object sender, RoutedEventArgs e) { WizardEventArg eee = new WizardEventArg(); if (!btn_next.Content.Equals("完成")) { if (OnStepChanged != null) { OnStepChanged(CurrStep, CurrStep + 1, eee); } if (eee.Cancel) { return; } CurrStep++; if (CurrStep <= TotalStep) { btn_prev.IsEnabled = true; tab1.SelectedIndex = CurrStep - 1; SetStepLbls(CurrStep); if (CurrStep == TotalStep) { btn_next.Content = "完成"; } } } else { JControlOutputData data1 = Communicator == null ? null : Communicator.OutputProperty(); JControlOutputData data2 = Adapter == null ? null : Adapter.OutputProperty(); string f1 = Communicator == null ? null : Communicator.GetType().FullName; string f2 = Adapter == null ? null : Adapter.GetType().FullName; if (OnFinished != null) { OnFinished(data1, data2, f1, f2); } this.Close(); } }
public void LoadFile(string fname) { JWCSerializer <JWCSaveFile> jse = new JWCSerializer <JWCSaveFile>(); JWCSaveFile file = jse.Deserialize(fname); stage.ClearAll(file.Width, file.Height); foreach (var s in file.AllControls) { string fullname = s["FullName"].ToString(); JWCControl jc = JWCControlFactory.CreateInstance(fullname); jc.InputProperty(s); jc.IsEditMode = true; jc.Init(true); stage.AddControl(jc); } Color cl = Color.FromArgb(file.BackColor[0], file.BackColor[1], file.BackColor[2], file.BackColor[3]); stage.SetBg(file.BgUsePic, cl, file.BackGroundPic); commu = file.Communicator; adapter = file.ComAdapter; ComFname = file.ComName; AdaFname = file.AdaName; }
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") { } }
public SLHelper(Stage st, JControlOutputData com, JControlOutputData ad) { stage = st; commu = com; adapter = ad; }