public void RemoveTemplateItemRow(UserWorkingProfileDS.TemplateItemRow row) { base.Rows.Remove(row); }
public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs) { XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(); XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence(); UserWorkingProfileDS userWorkingProfileDS = new UserWorkingProfileDS(); XmlSchemaAny xmlSchemaAny = new XmlSchemaAny(); xmlSchemaAny.Namespace = "http://www.w3.org/2001/XMLSchema"; xmlSchemaAny.MinOccurs = 0m; xmlSchemaAny.MaxOccurs = 79228162514264337593543950335m; xmlSchemaAny.ProcessContents = XmlSchemaContentProcessing.Lax; xmlSchemaSequence.Items.Add(xmlSchemaAny); XmlSchemaAny xmlSchemaAny2 = new XmlSchemaAny(); xmlSchemaAny2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; xmlSchemaAny2.MinOccurs = 1m; xmlSchemaAny2.ProcessContents = XmlSchemaContentProcessing.Lax; xmlSchemaSequence.Items.Add(xmlSchemaAny2); XmlSchemaAttribute xmlSchemaAttribute = new XmlSchemaAttribute(); xmlSchemaAttribute.Name = "namespace"; xmlSchemaAttribute.FixedValue = userWorkingProfileDS.Namespace; xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute); XmlSchemaAttribute xmlSchemaAttribute2 = new XmlSchemaAttribute(); xmlSchemaAttribute2.Name = "tableTypeName"; xmlSchemaAttribute2.FixedValue = "TemplateItemDataTable"; xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute2); xmlSchemaComplexType.Particle = xmlSchemaSequence; XmlSchema schemaSerializable = userWorkingProfileDS.GetSchemaSerializable(); XmlSchemaComplexType result; if (xs.Contains(schemaSerializable.TargetNamespace)) { MemoryStream memoryStream = new MemoryStream(); MemoryStream memoryStream2 = new MemoryStream(); try { schemaSerializable.Write(memoryStream); IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator(); while (enumerator.MoveNext()) { XmlSchema xmlSchema = (XmlSchema)enumerator.Current; memoryStream2.SetLength(0L); xmlSchema.Write(memoryStream2); if (memoryStream.Length == memoryStream2.Length) { memoryStream.Position = 0L; memoryStream2.Position = 0L; while (memoryStream.Position != memoryStream.Length && memoryStream.ReadByte() == memoryStream2.ReadByte()) { } if (memoryStream.Position == memoryStream.Length) { result = xmlSchemaComplexType; return result; } } } } finally { if (memoryStream != null) { memoryStream.Close(); } if (memoryStream2 != null) { memoryStream2.Close(); } } } xs.Add(schemaSerializable); result = xmlSchemaComplexType; return result; }
public void AddTemplateItemRow(UserWorkingProfileDS.TemplateItemRow row) { base.Rows.Add(row); }
public TemplateRootsRowChangeEvent(UserWorkingProfileDS.TemplateRootsRow row, DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs) { UserWorkingProfileDS userWorkingProfileDS = new UserWorkingProfileDS(); XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(); XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence(); XmlSchemaAny xmlSchemaAny = new XmlSchemaAny(); xmlSchemaAny.Namespace = userWorkingProfileDS.Namespace; xmlSchemaSequence.Items.Add(xmlSchemaAny); xmlSchemaComplexType.Particle = xmlSchemaSequence; XmlSchema schemaSerializable = userWorkingProfileDS.GetSchemaSerializable(); XmlSchemaComplexType result; if (xs.Contains(schemaSerializable.TargetNamespace)) { MemoryStream memoryStream = new MemoryStream(); MemoryStream memoryStream2 = new MemoryStream(); try { schemaSerializable.Write(memoryStream); IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator(); while (enumerator.MoveNext()) { XmlSchema xmlSchema = (XmlSchema)enumerator.Current; memoryStream2.SetLength(0L); xmlSchema.Write(memoryStream2); if (memoryStream.Length == memoryStream2.Length) { memoryStream.Position = 0L; memoryStream2.Position = 0L; while (memoryStream.Position != memoryStream.Length && memoryStream.ReadByte() == memoryStream2.ReadByte()) { } if (memoryStream.Position == memoryStream.Length) { result = xmlSchemaComplexType; return result; } } } } finally { if (memoryStream != null) { memoryStream.Close(); } if (memoryStream2 != null) { memoryStream2.Close(); } } } xs.Add(schemaSerializable); result = xmlSchemaComplexType; return result; }
private void SaveUserProfileFromTreeView() { string templatePathByUser = ApplicationInfo.GetTemplatePathByUser(); string fileName = templatePathByUser + "\\UserProfile.xml"; if (this.tdsUserProfile == null) { this.tdsUserProfile = new UserWorkingProfileDS(); } else { this.tdsUserProfile.Clear(); } for (int i = 0; i < this.tvTemplatesList.Nodes.Count; i++) { UserWorkingProfileDS.TemplateRootsRow templateRootsRow = this.tdsUserProfile.TemplateRoots.NewTemplateRootsRow(); templateRootsRow.TemplateName = this.tvTemplatesList.Nodes[i].Name; templateRootsRow.ListIndex = i; this.tdsUserProfile.TemplateRoots.AddTemplateRootsRow(templateRootsRow); for (int j = 0; j < this.tvTemplatesList.Nodes[i].Nodes.Count; j++) { UserWorkingProfileDS.TemplateItemRow templateItemRow = this.tdsUserProfile.TemplateItem.NewTemplateItemRow(); templateItemRow.ItemName = this.tvTemplatesList.Nodes[i].Nodes[j].Name.Trim(); templateItemRow.ListIndex = j; templateItemRow.IsDefalutTemplate = (this.tvTemplatesList.Nodes[i].Nodes[j].ImageKey == "ItemDefault"); templateItemRow.RootTemplateName = templateRootsRow.TemplateName; if (this.tvTemplatesList.Nodes[i].Nodes[j].Tag != null) { int hotKey = 0; int.TryParse(this.tvTemplatesList.Nodes[i].Nodes[j].Tag.ToString(), out hotKey); templateItemRow.HotKey = hotKey; } else { templateItemRow.HotKey = 0; } this.tdsUserProfile.TemplateItem.AddTemplateItemRow(templateItemRow); } } if (!Directory.Exists(templatePathByUser)) { Directory.CreateDirectory(templatePathByUser); } this.tdsUserProfile.WriteXml(fileName); }
private void LoadUserTemplate() { try { this.tdsUserProfile = new UserWorkingProfileDS(); string templatePathByUser = ApplicationInfo.GetTemplatePathByUser(); string text = templatePathByUser + "\\UserProfile.xml"; if (File.Exists(text)) { this.tdsUserProfile.ReadXml(text); } } catch (Exception ex) { this.ShowError("LoadUserTemplate", ex); } }
private void InitializeComponent() { this.components = new Container(); TreeNode treeNode = new TreeNode("Fixed Templates"); ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(TemplateTreeMenus)); this.tvTemplatesList = new TreeView(); this.ImageList = new ImageList(this.components); this.panelToolbarContainer = new Panel(); this.tsTempateEditor = new ToolStrip(); this.tsbtnView = new ToolStripButton(); this.tssepNodeMoveDownUseDefault = new ToolStripSeparator(); this.tsbtnHotkey = new ToolStripButton(); this.tsbtnUseDefault = new ToolStripButton(); this.tsbtnClearDefault = new ToolStripButton(); this.tssepLast = new ToolStripSeparator(); this.panelTemplateListContainer = new Panel(); this.panelDefaultTemplateInfo = new Panel(); this.lbDefault = new Label(); this.lblDefaultTemplateName = new Label(); this.tmRefresh = new Timer(this.components); this.tdsUserProfile = new UserWorkingProfileDS(); this.panelToolbarContainer.SuspendLayout(); this.tsTempateEditor.SuspendLayout(); this.panelTemplateListContainer.SuspendLayout(); this.panelDefaultTemplateInfo.SuspendLayout(); ((ISupportInitialize)this.tdsUserProfile).BeginInit(); base.SuspendLayout(); this.tvTemplatesList.Dock = DockStyle.Fill; this.tvTemplatesList.Font = new Font("Tahoma", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0); this.tvTemplatesList.ImageIndex = 4; this.tvTemplatesList.ImageList = this.ImageList; this.tvTemplatesList.Location = new Point(0, 0); this.tvTemplatesList.Margin = new Padding(4); this.tvTemplatesList.Name = "tvTemplatesList"; treeNode.Name = "treeNodeFixedTemplates"; treeNode.Text = "Fixed Templates"; this.tvTemplatesList.Nodes.AddRange(new TreeNode[] { treeNode }); this.tvTemplatesList.SelectedImageIndex = 4; this.tvTemplatesList.ShowRootLines = false; this.tvTemplatesList.Size = new Size(209, 312); this.tvTemplatesList.TabIndex = 0; this.tvTemplatesList.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(this.tvTemplatesList_NodeMouseDoubleClick); this.tvTemplatesList.AfterSelect += new TreeViewEventHandler(this.tvTemplatesList_AfterSelect); this.tvTemplatesList.MouseDown += new MouseEventHandler(this.tvTemplatesList_MouseDown); this.tvTemplatesList.KeyDown += new KeyEventHandler(this.tvTemplatesList_KeyDown); this.ImageList.ImageStream = (ImageListStreamer)componentResourceManager.GetObject("ImageList.ImageStream"); this.ImageList.TransparentColor = Color.Transparent; this.ImageList.Images.SetKeyName(0, "Drafts.bmp"); this.ImageList.Images.SetKeyName(1, "Outbox.bmp"); this.ImageList.Images.SetKeyName(2, "Recycle.bmp"); this.ImageList.Images.SetKeyName(3, "Send.bmp"); this.ImageList.Images.SetKeyName(4, "Collapsed"); this.ImageList.Images.SetKeyName(5, "Expanded"); this.ImageList.Images.SetKeyName(6, "Item"); this.ImageList.Images.SetKeyName(7, "ItemDefault"); this.ImageList.Images.SetKeyName(8, "ItemWarning"); this.panelToolbarContainer.BackColor = SystemColors.Info; this.panelToolbarContainer.BorderStyle = BorderStyle.FixedSingle; this.panelToolbarContainer.Controls.Add(this.tsTempateEditor); this.panelToolbarContainer.Dock = DockStyle.Left; this.panelToolbarContainer.Location = new Point(0, 0); this.panelToolbarContainer.Margin = new Padding(4); this.panelToolbarContainer.Name = "panelToolbarContainer"; this.panelToolbarContainer.Size = new Size(29, 342); this.panelToolbarContainer.TabIndex = 9; this.tsTempateEditor.BackgroundImageLayout = ImageLayout.None; this.tsTempateEditor.Dock = DockStyle.Fill; this.tsTempateEditor.Items.AddRange(new ToolStripItem[] { this.tsbtnView, this.tssepNodeMoveDownUseDefault, this.tsbtnHotkey, this.tsbtnUseDefault, this.tsbtnClearDefault, this.tssepLast }); this.tsTempateEditor.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow; this.tsTempateEditor.Location = new Point(0, 0); this.tsTempateEditor.Name = "tsTempateEditor"; this.tsTempateEditor.RenderMode = ToolStripRenderMode.System; this.tsTempateEditor.Size = new Size(27, 340); this.tsTempateEditor.TabIndex = 7; this.tsTempateEditor.Text = "toolStrip1"; this.tsbtnView.DisplayStyle = ToolStripItemDisplayStyle.Image; this.tsbtnView.Image = (Image)componentResourceManager.GetObject("tsbtnView.Image"); this.tsbtnView.ImageAlign = ContentAlignment.MiddleLeft; this.tsbtnView.ImageTransparentColor = Color.Magenta; this.tsbtnView.Name = "tsbtnView"; this.tsbtnView.Size = new Size(25, 20); this.tsbtnView.Text = "View"; this.tsbtnView.TextAlign = ContentAlignment.MiddleLeft; this.tsbtnView.ToolTipText = "View(Enter)"; this.tsbtnView.Click += new EventHandler(this.tsbtnView_Click); this.tssepNodeMoveDownUseDefault.Name = "tssepNodeMoveDownUseDefault"; this.tssepNodeMoveDownUseDefault.Size = new Size(25, 6); this.tsbtnHotkey.DisplayStyle = ToolStripItemDisplayStyle.Image; this.tsbtnHotkey.Image = (Image)componentResourceManager.GetObject("tsbtnHotkey.Image"); this.tsbtnHotkey.ImageAlign = ContentAlignment.MiddleLeft; this.tsbtnHotkey.ImageTransparentColor = Color.Magenta; this.tsbtnHotkey.Name = "tsbtnHotkey"; this.tsbtnHotkey.Size = new Size(25, 20); this.tsbtnHotkey.Text = "Hotkey"; this.tsbtnHotkey.TextAlign = ContentAlignment.MiddleLeft; this.tsbtnHotkey.Click += new EventHandler(this.tsmiHotkey_Click); this.tsbtnUseDefault.DisplayStyle = ToolStripItemDisplayStyle.Image; this.tsbtnUseDefault.Image = (Image)componentResourceManager.GetObject("tsbtnUseDefault.Image"); this.tsbtnUseDefault.ImageAlign = ContentAlignment.MiddleLeft; this.tsbtnUseDefault.ImageTransparentColor = Color.Magenta; this.tsbtnUseDefault.Name = "tsbtnUseDefault"; this.tsbtnUseDefault.Size = new Size(25, 20); this.tsbtnUseDefault.Text = "Set Default"; this.tsbtnUseDefault.TextAlign = ContentAlignment.MiddleLeft; this.tsbtnUseDefault.Click += new EventHandler(this.tsbtnUseDefault_Click); this.tsbtnClearDefault.DisplayStyle = ToolStripItemDisplayStyle.Image; this.tsbtnClearDefault.Image = (Image)componentResourceManager.GetObject("tsbtnClearDefault.Image"); this.tsbtnClearDefault.ImageAlign = ContentAlignment.MiddleLeft; this.tsbtnClearDefault.ImageTransparentColor = Color.Magenta; this.tsbtnClearDefault.Name = "tsbtnClearDefault"; this.tsbtnClearDefault.Size = new Size(25, 20); this.tsbtnClearDefault.Text = "Clear Default"; this.tsbtnClearDefault.TextAlign = ContentAlignment.MiddleLeft; this.tsbtnClearDefault.Click += new EventHandler(this.tsbtnClearDefault_Click); this.tssepLast.Name = "tssepLast"; this.tssepLast.Size = new Size(25, 6); this.panelTemplateListContainer.BorderStyle = BorderStyle.FixedSingle; this.panelTemplateListContainer.Controls.Add(this.tvTemplatesList); this.panelTemplateListContainer.Dock = DockStyle.Fill; this.panelTemplateListContainer.Location = new Point(29, 0); this.panelTemplateListContainer.Margin = new Padding(4); this.panelTemplateListContainer.Name = "panelTemplateListContainer"; this.panelTemplateListContainer.Size = new Size(211, 314); this.panelTemplateListContainer.TabIndex = 10; this.panelDefaultTemplateInfo.BorderStyle = BorderStyle.FixedSingle; this.panelDefaultTemplateInfo.Controls.Add(this.lbDefault); this.panelDefaultTemplateInfo.Controls.Add(this.lblDefaultTemplateName); this.panelDefaultTemplateInfo.Dock = DockStyle.Bottom; this.panelDefaultTemplateInfo.Location = new Point(29, 314); this.panelDefaultTemplateInfo.Margin = new Padding(4); this.panelDefaultTemplateInfo.Name = "panelDefaultTemplateInfo"; this.panelDefaultTemplateInfo.Size = new Size(211, 28); this.panelDefaultTemplateInfo.TabIndex = 11; this.lbDefault.AutoSize = true; this.lbDefault.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 222); this.lbDefault.Location = new Point(4, 2); this.lbDefault.Margin = new Padding(4, 0, 4, 0); this.lbDefault.Name = "lbDefault"; this.lbDefault.Size = new Size(52, 13); this.lbDefault.TabIndex = 1; this.lbDefault.Text = "Default:"; this.lblDefaultTemplateName.AutoSize = true; this.lblDefaultTemplateName.Font = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 222); this.lblDefaultTemplateName.Location = new Point(81, 2); this.lblDefaultTemplateName.Margin = new Padding(4, 0, 4, 0); this.lblDefaultTemplateName.Name = "lblDefaultTemplateName"; this.lblDefaultTemplateName.Size = new Size(34, 13); this.lblDefaultTemplateName.TabIndex = 0; this.lblDefaultTemplateName.Text = "Blank"; this.tmRefresh.Tick += new EventHandler(this.tmRefresh_Tick); this.tdsUserProfile.DataSetName = "UserProfileDS"; this.tdsUserProfile.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema; base.AutoScaleDimensions = new SizeF(8f, 16f); base.AutoScaleMode = AutoScaleMode.Font; base.Controls.Add(this.panelTemplateListContainer); base.Controls.Add(this.panelDefaultTemplateInfo); base.Controls.Add(this.panelToolbarContainer); this.Font = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 222); base.Margin = new Padding(4); base.Name = "TemplateTreeMenus"; base.Size = new Size(240, 342); this.panelToolbarContainer.ResumeLayout(false); this.panelToolbarContainer.PerformLayout(); this.tsTempateEditor.ResumeLayout(false); this.tsTempateEditor.PerformLayout(); this.panelTemplateListContainer.ResumeLayout(false); this.panelDefaultTemplateInfo.ResumeLayout(false); this.panelDefaultTemplateInfo.PerformLayout(); ((ISupportInitialize)this.tdsUserProfile).EndInit(); base.ResumeLayout(false); }
private static void InputHotkey(string groupName, UserWorkingProfileDS tdsUserProfile) { try { List<MainFixedTemplate.TemplateProperty> list = null; if (groupName == "Fixed") { list = MainFixedTemplate.GetFixedTemplateName(); } else if (groupName == "Order") { list = MainFixedTemplate.GetOrderTemplateName(); } UserWorkingProfileDS.TemplateItemRow[] array = (UserWorkingProfileDS.TemplateItemRow[])tdsUserProfile.TemplateItem.Select("RootTemplateName='" + groupName + "'", tdsUserProfile.TemplateItem.ListIndexColumn.ColumnName); string text = string.Empty; if (array.Length > 0) { UserWorkingProfileDS.TemplateItemRow[] array2 = array; for (int i = 0; i < array2.Length; i++) { UserWorkingProfileDS.TemplateItemRow templateItemRow = array2[i]; if (templateItemRow != null) { foreach (MainFixedTemplate.TemplateProperty current in list) { if (current.TempateName == templateItemRow.ItemName) { current.Hotkey = templateItemRow.HotKey; break; } } if (templateItemRow.IsDefalutTemplate) { text = templateItemRow.ItemName; } } } } foreach (MainFixedTemplate.TemplateProperty current2 in list) { HotKeyManager.AddTemplateHotkey(current2.TempateName, groupName, (Keys)current2.Hotkey); } } catch (Exception ex) { throw ex; } }
public static void Initial() { try { TemplateManager.Instance.DefaultTemplateName = string.Empty; TemplateManager.Instance.DefaultTemplateGroup = string.Empty; HotKeyManager.ClearTemplateHotkey(); UserWorkingProfileDS userWorkingProfileDS = new UserWorkingProfileDS(); string templatePathByUser = ApplicationInfo.GetTemplatePathByUser(); string text = templatePathByUser + "\\UserProfile.xml"; if (File.Exists(text)) { userWorkingProfileDS.ReadXml(text); } HotKeyManager.InputHotkey("Fixed", userWorkingProfileDS); HotKeyManager.InputHotkey("Order", userWorkingProfileDS); userWorkingProfileDS.Clear(); userWorkingProfileDS.Dispose(); } catch (Exception ex) { throw ex; } }