Exemplo n.º 1
0
 public void RemoveFormInfoRow(TemplateDS.FormInfoRow row)
 {
     base.Rows.Remove(row);
 }
Exemplo n.º 2
0
 public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
 {
     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType();
     XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
     TemplateDS templateDS = new TemplateDS();
     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 = templateDS.Namespace;
     xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute);
     XmlSchemaAttribute xmlSchemaAttribute2 = new XmlSchemaAttribute();
     xmlSchemaAttribute2.Name = "tableTypeName";
     xmlSchemaAttribute2.FixedValue = "FormInfoDataTable";
     xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute2);
     xmlSchemaComplexType.Particle = xmlSchemaSequence;
     XmlSchema schemaSerializable = templateDS.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;
 }
Exemplo n.º 3
0
 public void AddFormInfoRow(TemplateDS.FormInfoRow row)
 {
     base.Rows.Add(row);
 }
Exemplo n.º 4
0
 public void RemoveTemplatePropertyRow(TemplateDS.TemplatePropertyRow row)
 {
     base.Rows.Remove(row);
 }
Exemplo n.º 5
0
 public TemplatePropertyRowChangeEvent(TemplateDS.TemplatePropertyRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
Exemplo n.º 6
0
 public FormRememberFieldRowChangeEvent(TemplateDS.FormRememberFieldRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
Exemplo n.º 7
0
 public void AddTemplatePropertyRow(TemplateDS.TemplatePropertyRow row)
 {
     base.Rows.Add(row);
 }
Exemplo n.º 8
0
 public void RemoveFormRememberFieldRow(TemplateDS.FormRememberFieldRow row)
 {
     base.Rows.Remove(row);
 }
Exemplo n.º 9
0
 public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
 {
     TemplateDS templateDS = new TemplateDS();
     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType();
     XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
     XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();
     xmlSchemaAny.Namespace = templateDS.Namespace;
     xmlSchemaSequence.Items.Add(xmlSchemaAny);
     xmlSchemaComplexType.Particle = xmlSchemaSequence;
     XmlSchema schemaSerializable = templateDS.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;
 }
Exemplo n.º 10
0
 public void AddFormRememberFieldRow(TemplateDS.FormRememberFieldRow row)
 {
     base.Rows.Add(row);
 }
Exemplo n.º 11
0
 public void AddFormPropertyRow(TemplateDS.FormPropertyRow row)
 {
     base.Rows.Add(row);
 }
Exemplo n.º 12
0
 public FormInfoRowChangeEvent(TemplateDS.FormInfoRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
Exemplo n.º 13
0
 private void SaveTemplate()
 {
     if (base.InvokeRequired)
     {
         base.Invoke(new MethodInvoker(this.SaveTemplate));
     }
     else
     {
         try
         {
             string text = string.Empty;
             string text2 = string.Empty;
             string name = TemplateManager.Instance.CurrentActiveTemplateView.Name;
             TemplateView.ContentState templateState = TemplateManager.Instance.GetTemplateState(TemplateManager.Instance.CurrentActiveTemplateView.Name);
             text = TemplateManager.Instance.CurrentActiveTemplateView.Name;
             text2 = ApplicationInfo.GetTemplatePathByUser();
             if (!string.IsNullOrEmpty(text))
             {
                 Form activeMdiChild = base.ActiveMdiChild;
                 string str = text + ".xml";
                 TemplateDS templateDS = new TemplateDS();
                 Dictionary<string, object> templateProperties = TemplateManager.Instance.GetTemplateProperties(text);
                 if (templateProperties != null)
                 {
                     TemplateDS.TemplatePropertyRow templatePropertyRow = templateDS.TemplateProperty.NewTemplatePropertyRow();
                     templatePropertyRow.PropertyName = "Name";
                     templatePropertyRow.PropertyValue = text;
                     templateDS.TemplateProperty.AddTemplatePropertyRow(templatePropertyRow);
                     foreach (KeyValuePair<string, object> current in templateProperties)
                     {
                         if (current.Key != "Name")
                         {
                             templatePropertyRow = templateDS.TemplateProperty.NewTemplatePropertyRow();
                             templatePropertyRow.PropertyName = current.Key;
                             templatePropertyRow.PropertyValue = current.Value.ToString();
                             templateDS.TemplateProperty.AddTemplatePropertyRow(templatePropertyRow);
                         }
                     }
                     List<Dictionary<string, object>> allFormProperties = TemplateManager.Instance.GetAllFormProperties(text);
                     if (allFormProperties != null && allFormProperties.Count > 0)
                     {
                         int num = 0;
                         foreach (Dictionary<string, object> current2 in allFormProperties)
                         {
                             num++;
                             if (current2 != null)
                             {
                                 TemplateDS.FormInfoRow formInfoRow = templateDS.FormInfo.NewFormInfoRow();
                                 formInfoRow.FormID = num;
                                 foreach (KeyValuePair<string, object> current3 in current2)
                                 {
                                     if (current3.Key == "Type")
                                     {
                                         formInfoRow.Type = current3.Value.ToString();
                                     }
                                     else if (current3.Key == "Name")
                                     {
                                         formInfoRow.Name = current3.Value.ToString();
                                     }
                                     else
                                     {
                                         TemplateDS.FormPropertyRow formPropertyRow = templateDS.FormProperty.NewFormPropertyRow();
                                         formPropertyRow.FormID = num;
                                         formPropertyRow.PropertyName = current3.Key;
                                         if (current3.Key == "Font")
                                         {
                                             Font font = (Font)current3.Value;
                                             formPropertyRow.PropertyValue = string.Format("{0}|{1}|{2}", font.Name, font.Size, (int)font.Style);
                                         }
                                         else
                                         {
                                             formPropertyRow.PropertyValue = current3.Value.ToString();
                                         }
                                         templateDS.FormProperty.AddFormPropertyRow(formPropertyRow);
                                     }
                                 }
                                 templateDS.FormInfo.AddFormInfoRow(formInfoRow);
                                 if (current2.ContainsKey("Name"))
                                 {
                                     Dictionary<string, object> formPropertyFields = TemplateManager.Instance.GetFormPropertyFields(text, current2["Name"].ToString());
                                     if (formPropertyFields != null)
                                     {
                                         foreach (KeyValuePair<string, object> current4 in formPropertyFields)
                                         {
                                             TemplateDS.FormRememberFieldRow formRememberFieldRow = templateDS.FormRememberField.NewFormRememberFieldRow();
                                             formRememberFieldRow.FormID = num;
                                             formRememberFieldRow.FieldName = current4.Key;
                                             formRememberFieldRow.FieldValue = current4.Value.ToString();
                                             templateDS.FormRememberField.AddFormRememberFieldRow(formRememberFieldRow);
                                         }
                                     }
                                 }
                             }
                         }
                         try
                         {
                             if (!Directory.Exists(text2))
                             {
                                 Directory.CreateDirectory(text2);
                             }
                             templateDS.WriteXml(text2 + "\\" + str);
                         }
                         catch (Exception ex)
                         {
                             this.ShowError("SaveTemplate", ex);
                             return;
                         }
                     }
                 }
             }
             text = null;
             text2 = null;
         }
         catch (Exception ex)
         {
             this.ShowError("SaveTemplate", ex);
         }
     }
 }
Exemplo n.º 14
0
 private void OpenTemplate(string templateName, string subPage)
 {
     try
     {
         if (!this.IsOpeningTemplate)
         {
             if (!(this.OpenTemplateLastTime.AddMilliseconds(100.0) >= DateTime.Now))
             {
                 if (TemplateManager.Instance.CurrentActiveTemplateView != null)
                 {
                     this._lastTemplate = TemplateManager.Instance.CurrentActiveTemplateView.Name;
                 }
                 if (this.ViewOrderBox != null)
                 {
                     this.ViewOrderBox.CloseViewOrderInfoBox();
                 }
                 this.OpenTemplateLastTime = DateTime.Now;
                 this.IsOpeningTemplate = true;
                 if (TemplateManager.Instance.IsTemplateContains(templateName))
                 {
                     if (subPage != string.Empty && templateName == "Summary")
                     {
                         ((frmStockSummary)TemplateManager.Instance.TemplateViews["Summary"].FormObj).SubPage = subPage;
                     }
                     TemplateManager.Instance.Show(templateName);
                     this.SetMenu(templateName);
                     this.IsOpeningTemplate = false;
                 }
                 else
                 {
                     string text = string.Empty;
                     bool flag = false;
                     text = ApplicationInfo.GetTemplatePathByUser();
                     if (text != string.Empty)
                     {
                         text = text + "\\" + templateName + ".xml";
                         if (File.Exists(text))
                         {
                             flag = true;
                         }
                     }
                     TemplateView templateView = templateView = TemplateManager.Instance.CreateTemplateView(templateName);
                     templateView.CurrentState = TemplateView.ContentState.OpeningOrClosing;
                     Dictionary<string, object> dictionary = new Dictionary<string, object>();
                     if (flag)
                     {
                         TemplateDS templateDS = new TemplateDS();
                         templateDS.ReadXml(text);
                         TemplateDS.FormRememberFieldRow[] array = (TemplateDS.FormRememberFieldRow[])templateDS.FormRememberField.Select();
                         TemplateDS.FormRememberFieldRow[] array2 = array;
                         for (int i = 0; i < array2.Length; i++)
                         {
                             TemplateDS.FormRememberFieldRow formRememberFieldRow = array2[i];
                             dictionary.Add(formRememberFieldRow.FieldName, formRememberFieldRow.FieldValue);
                         }
                     }
                     List<MainFixedTemplate.ControlClient> list = MainFixedTemplate.GetFixedTemplate(templateName);
                     foreach (MainFixedTemplate.ControlClient current in list)
                     {
                         if (dictionary.Count == 0)
                         {
                             dictionary = current.Property;
                         }
                         Form form;
                         if (subPage == string.Empty)
                         {
                             form = (Form)Activator.CreateInstance(current.ControlType, new object[]
                             {
                                 dictionary
                             });
                         }
                         else
                         {
                             form = (Form)Activator.CreateInstance(current.ControlType, new object[]
                             {
                                 dictionary,
                                 subPage
                             });
                         }
                         Form expr_2BE = form;
                         expr_2BE.Name += form.GetHashCode().ToString();
                         form.FormBorderStyle = FormBorderStyle.None;
                         form.TopLevel = false;
                         form.Bounds = this.GetWorkingArea();
                         form.Anchor = (AnchorStyles.Top | AnchorStyles.Left);
                         form.Parent = this;
                         this.SetEventToNewForm(form);
                         TemplateManager.Instance.AddFormToTemplate(templateName, form, current.FormIndex);
                         Thread.Sleep(10);
                     }
                     list.Clear();
                     list = null;
                     dictionary.Clear();
                     dictionary = null;
                     TemplateManager.Instance.SetTabControl(templateName);
                     TemplateManager.Instance.Show(templateName);
                     this.SetMenu(templateName);
                     templateView.CurrentState = TemplateView.ContentState.Unchanged;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         this.ShowError("OpenTemplate", ex);
     }
     finally
     {
         this.IsOpeningTemplate = false;
     }
 }