/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _btnSave_Click(object sender, RoutedEventArgs e) { LicenseTemplete licenseTemplete = new LicenseTemplete(); licenseTemplete.ActivityGuid = CO_IA.Client.RiasPortal.ModuleContainer.Activity.Guid; licenseTemplete.Height = double.Parse(this._txtHeight.Text); licenseTemplete.Width = double.Parse(this._txtWidth.Text); licenseTemplete.IsShowImage = _chkImage.IsChecked.Value; licenseTemplete.BackgroundImage = this.backgroundImageSource; licenseTemplete.IsShowQRCode = _chkQRCode.IsChecked.Value; if (this.QRCodeImageSource == null) { MessageBox.Show("请生成二维码"); return; } else { licenseTemplete.QRCode = this.QRCodeImageSource; } if (_canvasPanel.Children.Count > 0) { foreach (FrameworkElement itemcontrol in _canvasPanel.Children) { if (itemcontrol.GetType() == typeof(LicenseItemControl)) { LicenseItemControl licenseControl = (LicenseItemControl)itemcontrol; LicenseItem licenseitem = new LicenseItem(); licenseitem.Left = (double)licenseControl.GetValue(Canvas.LeftProperty); licenseitem.Top = (double)licenseControl.GetValue(Canvas.TopProperty); licenseitem.PropertyName = licenseControl.PropertyName; licenseTemplete.LicenseItems.Add(licenseitem); } } } else { MessageBox.Show("请添加模板内容"); return; } licenseTemplete.XMLLicenseItems = GetXmlByLicenseTemplete(licenseTemplete); try { SaveLicenseTemplete(licenseTemplete); MessageBox.Show("保存成功"); } catch (Exception ex) { MessageBox.Show(ex.GetExceptionMessage()); } }
private void ImageUp_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { double topvalue; if (IsQRCodeSelect) { topvalue = (double)_borderqriamge.GetValue(Canvas.TopProperty); if (topvalue > 0) { Canvas.SetTop(_borderqriamge, topvalue - 1); } } else if (selectLicenseItemControl != null && selectLicenseItemControl.IsSelect) { topvalue = (double)selectLicenseItemControl.GetValue(Canvas.TopProperty); if (topvalue > 0) { Canvas.SetTop(selectLicenseItemControl, (double)selectLicenseItemControl.GetValue(Canvas.TopProperty) - 1); } } }