public void Show(Lib header) { _LibHeader = header; TbText.Text = _LibHeader.Text; TbScript.Text = _LibHeader.Script; TbMemo.Text = _LibHeader.Memo; }
public void Init(DataModel dataModel, ViewModel viewModel) { _DataModel = dataModel; TbName.GotFocus += new EventHandler(TbName_GotFocus); TbMeta.GotFocus += new EventHandler(TbMeta_GotFocus); TbAuto.GotFocus += new EventHandler(TbMemo_GotFocus); _DefLib = new Lib { Id = "", Text = "请选择", Target = "", Script = "" }; }
/// <summary> /// 口令数据 /// </summary> /// <param name="index"></param> public bool InitData(Lib header) { for (int i = _AttList.Count - 1; i >= Att.HEAD_SIZE; i -= 1) { _AttList.RemoveAt(i); } Att att = _AttList[Att.PWDS_HEAD_AUTO]; att.Text = header.Target ?? ""; att.Data = header.Script ?? ""; int order = 1; foreach (LibDetail detail in header.Details) { att = Att.GetInstance(detail.Type, detail.Text, detail.Data); att.Id = (_Key.AttIndex++).ToString(); att.Order = (order++).ToString(); _AttList.Add(att); } return true; }
public void InitOnce(DataModel dataModel, ViewModel viewModel) { _DataModel = dataModel; _DefLib = new Lib { Id = "", Text = "请选择", Target = "", Script = "" }; }
private void ImportWPwdLib(AUserModel userModel, XmlReaderSettings setting) { string file = Path.Combine(userModel.DatHome, "WPwd-Lib.xml"); if (File.Exists(file)) { return; } StreamReader stream = new StreamReader(file); using (XmlReader reader = XmlReader.Create(stream, setting)) { Lib header; while (reader.Name == "Lib" || reader.ReadToFollowing("Lib")) { header = new Lib(); if (!header.FromXml(reader)) { continue; } _DataModel.DeleteVcs(header); _DataModel.SaveVcs(header); } } stream.Close(); }
private void InitLib_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) { if (e.Error != null) { _SignAc.HideWaiting(); Main.ShowAlert(e.Error.Message); return; } string xml = e.Result; using (XmlReader reader = XmlReader.Create(new StringReader(xml))) { if (xml.IndexOf("<Error>") > 0) { _SignAc.HideWaiting(); reader.ReadToFollowing("Error"); Main.ShowAlert(reader.ReadElementContentAsString()); return; } Lib header; while (reader.Name == "Lib" || reader.ReadToFollowing("Lib")) { header = new Lib(); if (!header.FromXml(reader)) { continue; } _DataModel.SaveVcs(header); } } WebClient client = new WebClient(); client.Headers["Content-type"] = "application/x-www-form-urlencoded"; client.Encoding = Encoding.UTF8; client.UploadStringCompleted += new UploadStringCompletedEventHandler(InitUdc_UploadStringCompleted); client.UploadStringAsync(new Uri(CApp.SERVER_PATH), "POST", "&o=udc&c=" + _UserModel.Code); }
private void ShowHeader(Lib header) { if (_UcEditer.Name != "LibHeader") { GbGroup.Controls.Clear(); _UcHeader.Location = new System.Drawing.Point(6, 20); _UcHeader.Size = new System.Drawing.Size(231, 183); _UcHeader.TabIndex = 0; GbGroup.Controls.Add(_UcHeader); GbGroup.Text = "模板"; _UcEditer = _UcHeader; } _UcHeader.Show(header); }
public void SaveHeader(Lib header) { if (CharUtil.IsValidateHash(header.Id)) { _Selected.Text = header.Text; _Selected.ToolTipText = header.Memo; } else { _DataModel.LibList.Add(header); TreeNode node = new TreeNode(); node.Name = header.Id; node.Tag = header; node.Text = header.Text; node.ToolTipText = header.Memo; TvLibView.Nodes.Add(node); TvLibView.SelectedNode = null; } _DataModel.SaveVcs(header); _DataModel.LibModified = -1; }
private void InitDat() { _UserModel.Load(); BeanUtil.UnZip(CApp.FILE_DAT, _UserModel.DatHome); _DataModel = new ADataModel(_UserModel); _DataModel.Init(); string file; StreamReader stream; XmlReaderSettings setting = new XmlReaderSettings { IgnoreWhitespace = true }; #region 字符 file = Path.Combine(_UserModel.DatHome, "App-Udc.xml"); if (File.Exists(file)) { stream = new StreamReader(file); using (XmlReader reader = XmlReader.Create(stream, setting)) { Udc udc; while (reader.Name == "Udc" || reader.ReadToFollowing("Udc")) { udc = new Udc(); if (!udc.FromXml(reader)) { continue; } _DataModel.SaveVcs(udc); } } stream.Close(); } #endregion #region 类别 file = Path.Combine(_UserModel.DatHome, "App-Cat.xml"); if (File.Exists(file)) { stream = new StreamReader(file); using (XmlReader reader = XmlReader.Create(stream, setting)) { Cat cat; while (reader.Name == "Cat" || reader.ReadToFollowing("Cat")) { cat = new Cat(); if (!cat.FromXml(reader)) { continue; } _DataModel.SaveVcs(cat); } } stream.Close(); } #endregion #region 模板 file = Path.Combine(_UserModel.DatHome, "WPwd-Lib.xml"); if (File.Exists(file)) { stream = new StreamReader(file); using (XmlReader reader = XmlReader.Create(stream, setting)) { Lib header; while (reader.Name == "Lib" || reader.ReadToFollowing("Lib")) { header = new Lib(); if (!header.FromXml(reader)) { continue; } _DataModel.SaveVcs(header); } } stream.Close(); } #endregion #region 目录 file = Path.Combine(_UserModel.DatHome, "WPwd-Dir.xml"); if (File.Exists(file)) { stream = new StreamReader(file); using (XmlReader reader = XmlReader.Create(stream, setting)) { Dir dir; while (reader.Name == "Dir" || reader.ReadToFollowing("Dir")) { dir = new Dir(); if (!dir.FromXml(reader)) { continue; } _DataModel.SaveVcs(dir); } } stream.Close(); } #endregion _DataModel.Dispose(); _SignAc.CallBack(CApp.IAPP_WPWD); }