public BatchUpdate(XmlItem ctrlDef) { m_ctrlDef = ctrlDef; InitializeComponent(); this.Owner = MainWindow.s_pW; s_pW = this; refreshCtrlComboBox(); }
public bool ContainsBand(string bandName) { for (int i = 0; i < xmlItem.Count; i++) { XmlItem xi = xmlItem[i]; BandBase obj = preparedPages.Dictionary.GetOriginalObject(xi.Name) as BandBase; if (obj != null && obj.Name == bandName) { return(true); } } return(false); }
private void UpdateUnlimitedPage(Base obj, XmlItem item) { item.Clear(); using (FRWriter writer = new FRWriter(item)) { writer.SerializeTo = SerializeTo.Preview; writer.SaveChildren = false; writer.BlobStore = preparedPages.BlobStore; writer.Write(obj); } foreach (Base child in obj.ChildObjects) { UpdateUnlimitedPage(child, item.Add()); } }
private void btnCustom_Click(object sender, EventArgs e) { using (CustomLabelForm form = new CustomLabelForm()) { XmlItem customManufacturer = FLabels.Root[FLabels.Root.Count - 1]; form.Init(Res.Get("Forms,LabelWizard,Label") + (customManufacturer.Count + 1).ToString()); if (form.ShowDialog() == DialogResult.OK) { customManufacturer.AddItem(form.LabelParameters); cbxLabels.SelectedIndex = cbxLabels.Items.Count - 1; cbxLabels_SelectedIndexChanged(this, EventArgs.Empty); lbxLabels.SelectedIndex = lbxLabels.Items.Count - 1; } } }
public bool ContainsBand(Type bandType) { for (int i = 0; i < FXmlItem.Count; i++) { XmlItem xi = FXmlItem[i]; BandBase obj = FPreparedPages.Dictionary.GetOriginalObject(xi.Name) as BandBase; if (obj != null && obj.GetType() == bandType) { return(true); } } return(false); }
private void Done() { if (DialogResult == DialogResult.OK) { FRich.Text = rtbText.Rtf; } FExpandedNodes = tvData.ExpandedNodes; Config.SaveFormState(this); XmlItem xi = Config.Root.FindItem("Forms").FindItem("RichEditorForm"); xi.SetProp("Splitter", splitContainer1.SplitterDistance.ToString()); xi.SetProp("DescriptionHeight", lblDescription.Height.ToString()); xi.SetProp("Zoom", cbxZoom.SelectedItem.ToString()); }
void BuildOutline(StringBuilder sb, XmlItem xml, bool top) { for (int i = 0; i < xml.Count; i++) { var opened = false; if (top && xml.Count == 1) // open if there is only one node on top { opened = true; } var styleShow = opened ? @"style=""display:none""" : @"style=""display:block"""; var styleHide = opened ? @"style=""display:block""" : @"style=""display:none"""; var node = xml[i]; var hasChildren = node.Count > 0; var(text, page, offset) = ReadOutlineNode(node); var nodeId = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{ID}{page}{offset}{sb.Length}{GetCurrentTabName()}")); sb.Append($@"<div class=""{template_FR}-outline-node"">"); string caret; if (hasChildren) { caret = $@"<img class=""{template_FR}-outline-caret {template_FR}-js-outline-open-node"" src=""{template_resource_url("caret-right.svg", "image/svg+xml")}"" data-fr-outline-node-id=""{nodeId}"" onclick=""{template_FR}.outlineOpenNode(this);"" {styleShow}>"; caret += $@"<img class=""{template_FR}-outline-caret {template_FR}-js-outline-close-node"" src=""{template_resource_url("caret-down.svg", "image/svg+xml")}"" data-fr-outline-node-id=""{nodeId}"" onclick=""{template_FR}.outlineCloseNode(this);"" {styleHide}>"; } else { caret = $@"<div class=""{template_FR}-outline-caret-blank""></div>"; } sb.Append($@"<div class=""{template_FR}-outline-text"">"); sb.Append(caret); sb.Append($@"<img class=""{template_FR}-outline-file"" src=""{template_resource_url("file.svg", "image/svg+xml")}"">"); sb.Append($@"<a onclick=""{template_FR}.outlineGoto({page + 1}, {offset.ToString().Replace(',', '.')});"">{HttpUtility.HtmlEncode(text)}</a>"); sb.Append($@"</div>"); if (hasChildren) { sb.Append($@"<div style=""width:100%""></div>"); // line break sb.Append($@"<div class=""{template_FR}-outline-children"" {styleHide}>"); BuildOutline(sb, node, false); sb.Append("</div>"); } sb.Append("</div>"); } }
private static XmlDocument formatXml(XmlItem item, string path) { XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement(item.Element); doc.AppendChild(root); fillAttributes(doc, item.Attributes, root); XmlNode fields = newNode(doc, "fields", root); fillFields(doc, item.Fields, fields); doc.Save(path); return(doc); }
public void UpdateValue(string key, string newValue) { StatsEntry entry = Get(key); if (entry.Value != newValue) { entry.Value = newValue; XmlItem xml = new XmlItem("command"); xml.SetAttribute("action", "ui.stats.change"); entry.WriteXML(xml); Engine.Instance.Command(xml); Engine.Instance.OnStatsChange(entry); } }
private void StartKeep(BandBase band) { // do not keep the first row on a page, avoid empty first page if (FKeeping || (band != null && band.AbsRowNo == 1 && !band.FirstRowStartsNewPage)) { return; } FKeeping = true; FKeepPosition = PreparedPages.CurPosition; FKeepOutline = PreparedPages.Outline.CurPosition; FKeepBookmarks = PreparedPages.Bookmarks.CurPosition; FKeepCurY = CurY; Report.Dictionary.Totals.StartKeep(); StartKeepReprint(); }
public static void HtmlToCli(string data) { XmlItem xml = new XmlItem(data); string action = xml.GetAttribute("action"); // Look WebView.cs comment about the Mono bug // Core.Send (data); // Alternative workaround, send to JS for direct delivery via /api/command/ // Maybe totally TOCLEAN if i always use a TCP method. Gtk.Application.Invoke(delegate { string jsStr = CommonUtils.JsonEncode(data); string js = "Eddie.command(\"" + jsStr + "\")"; m_webBrowser.ExecuteScript(js); }); }
public IEnumerable <SheetInfo> EnumSheetInfos() { for (int i = 0; i < sheetFiles.Length; i++) { var sheetFile = sheetFiles[i]; using (var stream = xmlFiles.OpenReadFile(sheetFile)) using (var reader = XmlReader.Create(stream)) { var sheetCells = XmlItem.Read(reader); yield return(new SheetInfo() { reader = this, sheetFile = sheetFile, sheetCells = sheetCells, sheetName = sheetNames[i] }); } } }
/// <summary> /// Saves prepared pages to a stream. /// </summary> /// <param name="stream">The stream to save to.</param> public void Save(Stream stream) { stream = Compressor.Compress(stream); using (XmlDocument doc = new XmlDocument()) { doc.AutoIndent = true; doc.Root.Name = "preparedreport"; XmlItem pages = doc.Root.Add(); pages.Name = "pages"; // attach each page's xml to the doc foreach (PreparedPage page in FPreparedPages) { pages.AddItem(page.Xml); } XmlItem sourcePages = doc.Root.Add(); sourcePages.Name = "sourcepages"; SourcePages.Save(sourcePages); XmlItem dictionary = doc.Root.Add(); dictionary.Name = "dictionary"; Dictionary.Save(dictionary); XmlItem bookmarks = doc.Root.Add(); bookmarks.Name = "bookmarks"; Bookmarks.Save(bookmarks); doc.Root.AddItem(Outline.Xml); XmlItem blobStore = doc.Root.Add(); blobStore.Name = "blobstore"; BlobStore.Save(blobStore); doc.Save(stream); // detach each page's xml from the doc foreach (PreparedPage page in FPreparedPages) { page.Xml.Parent = null; } Outline.Xml.Parent = null; } stream.Dispose(); }
private void Done() { if (DialogResult == DialogResult.OK) { Connection.Name = tbConnName.Text; // enable items that we have checked in the table tree foreach (TreeNode tableNode in tvTables.Nodes) { TableDataSource table = tableNode.Tag as TableDataSource; if (table != null) { table.Enabled = tableNode.Checked; foreach (TreeNode colNode in tableNode.Nodes) { Column column = colNode.Tag as Column; if (column != null) { column.Enabled = colNode.Checked; } } } } // create relations if any Connection.CreateRelations(); XmlItem root = Config.Root.FindItem("Designer").FindItem("LastConnections"); using (FRWriter writer = new FRWriter(root)) { root.Clear(); writer.Write(FConnections); } } if (ApplicationConnectionMode) { // in this mode, we don't have to store connection string in the report Connection.ConnectionString = ""; } if (DialogResult == DialogResult.OK || EditMode) { FConnections.Remove(Connection); } FConnections.Dispose(); }
public void UpdateFromXmlItem(XmlItem xmlItem) { var oldTypeId = _xml.ID; setXml(xmlItem); Name = xmlItem.Name; TypeID = xmlItem.ID; if (xmlItem != XmlItem.Empty) { SetValue("version", 1); if (null != xmlItem.LongName && xmlItem.LongName.Length > 0) { LongName = xmlItem.LongName; } if (null != xmlItem.Tooltip && xmlItem.Tooltip.Length > 0) { Tooltip = xmlItem.Tooltip; } if (null != xmlItem.Variant && xmlItem.Variant.Length > 0) { Variant = xmlItem.Variant; } Quantity = xmlItem.Stack; } //update all items for is selected foreach (var group in AllGroups) { foreach (var item in group.Items) { item.NotifyIsSelectedChanged(); } } OnPropertyChanged("DisplayName"); OnPropertyChanged("QuantityDescription"); OnPropertyChanged("MaxQuantity"); //check if we have to reflow the inventory if (oldTypeId == XmlItem.Empty.ID || xmlItem.ID == XmlItem.Empty.ID) { _character.CleanupInventory(); _character.UpdateInventory(); } }
private Base ReadObject(Base parent, XmlItem item, bool readChildren) { string objName = item.Name; // try to find the object in the dictionary Base obj = FPreparedPages.Dictionary.GetObject(objName); // object not found, objName is type name if (obj == null) { Type type = RegisteredObjects.FindType(objName); if (type == null) { return(null); } obj = Activator.CreateInstance(type) as Base; } obj.SetRunning(true); // read object's properties if (!String.IsNullOrEmpty(item.Text)) { using (FRReader reader = new FRReader(null, item)) { reader.ReadChildren = false; reader.BlobStore = FPreparedPages.BlobStore; // since the BlobStore is shared resource, lock it to avoid problems with multi-thread access. // this may happen in the html export that uses several threads to export one report. lock (reader.BlobStore) { reader.Read(obj); } } } if (readChildren) { for (int i = 0; i < item.Count; i++) { ReadObject(obj, item[i], true); } } obj.Parent = parent; return(obj); }
private void Init() { ts1.Font = DrawUtils.Default96Font; cbxFontName.Font = ts1.Font; cbxFontSize.Font = ts1.Font; btnColor.DefaultColor = Color.Black; ts1.Renderer = Config.DesignerSettings.ToolStripRenderer; tvData.CreateNodes(FRich.Report.Dictionary); if (FExpandedNodes != null) { tvData.ExpandedNodes = FExpandedNodes; } rtbText.Rtf = FRich.Text; if (rtbText.TextLength == 0) { rtbText.SelectAll(); rtbText.SelectionFont = Config.DesignerSettings.DefaultFont; } rtbText.Modified = false; rtbText.AllowDrop = true; rtbText.DragEnter += new DragEventHandler(rtbText_DragEnter); rtbText.DragDrop += new DragEventHandler(rtbText_DragDrop); Config.RestoreFormState(this); XmlItem xi = Config.Root.FindItem("Forms").FindItem("RichEditorForm"); string s = xi.GetProp("Splitter"); if (s != "") { splitContainer1.SplitterDistance = int.Parse(s); } s = xi.GetProp("DescriptionHeight"); if (s != "") { lblDescription.Height = int.Parse(s); } s = xi.GetProp("Zoom"); if (s == "") { s = "100%"; } cbxZoom.SelectedIndex = cbxZoom.Items.IndexOf(s); }
private void EnumNodes(XmlItem rootItem, NodeCollection rootNode) { // skip root xml item if (rootItem.Parent != null) { string text = Converter.FromXml(rootItem.GetProp("Text")); Node node = new Node(); node.Text = text; node.Tag = rootItem; rootNode.Add(node); rootNode = node.Nodes; } for (int i = 0; i < rootItem.Count; i++) { EnumNodes(rootItem[i], rootNode); } }
public PreparedPage(ReportPage page, PreparedPages preparedPages) { FPreparedPages = preparedPages; FXmlItem = new XmlItem(); // page == null when we load prepared report from a file if (page != null) { using (FRWriter writer = new FRWriter(FXmlItem)) { writer.SerializeTo = SerializeTo.Preview; writer.SaveChildren = false; writer.Write(page); } FPageSize = new SizeF(page.PaperWidth * Units.Millimeters, page.PaperHeight * Units.Millimeters); } }
private void RestoreState() { XmlItem xi = Config.Root.FindItem("Preview"); string zoom = xi.GetProp("Zoom"); if (!String.IsNullOrEmpty(zoom)) { FDefaultZoom = (float)Converter.FromString(typeof(float), zoom); } string width = xi.GetProp("OutlineWidth"); if (!String.IsNullOrEmpty(width)) { outlineControl.Width = int.Parse(width); } }
public PreparedPage(ReportPage page, PreparedPages preparedPages) { this.preparedPages = preparedPages; xmlItem = new XmlItem(); // page == null when we load prepared report from a file if (page != null) { using (FRWriter writer = new FRWriter(xmlItem)) { writer.SerializeTo = SerializeTo.Preview; writer.SaveChildren = false; writer.Write(page); } pageSize = new SizeF(page.WidthInPixels, page.HeightInPixels); } }
public override void Done(DialogResult result) { if (result == DialogResult.OK) { FDesigner.UIStyle = (UIStyle)cbxUIStyle.SelectedIndex; Config.UIStyle = FDesigner.UIStyle; XmlItem pluginsItem = Config.Root.FindItem("Plugins"); pluginsItem.Clear(); foreach (object item in lbPlugins.Items) { XmlItem xi = pluginsItem.Add(); xi.Name = "Plugin"; xi.SetProp("Name", item.ToString()); } } }
internal void Shift(XmlItem from, float newY) { if (from == null || from.Parent == null) { return; } int i = from.Parent.IndexOf(from); if (i + 1 >= from.Parent.Count) { return; } from = from.Parent[i + 1]; float topY = Converter.StringToFloat(from.GetProp("Offset")); EnumItems(from, newY - topY); }
public void Save(XmlItem rootItem) { rootItem.Clear(); foreach (KeyValuePair <string, DictionaryItem> pair in names) { XmlItem xi = rootItem.Add(); xi.Name = pair.Key; xi.ClearProps(); xi.SetProp("name", pair.Value.SourceName); //xi.Text = String.Concat("name=\"", pair.Value.SourceName, "\""); } //for (int i = 0; i < FNames.Count; i++) //{ // XmlItem xi = rootItem.Add(); // xi.Name = FNames.Keys[i]; // xi.Text = "name=\"" + FNames.Values[i].SourceName + "\""; //} }
public ItemSlotVM(CharacterVM character, AmfObject obj, ItemCategories categories) : base(obj) { Categories = categories; _character = character; //find the xml definition for this slot type var id = GetString("classInstance"); _xml = XmlItem.Empty; foreach (XmlItem item in XmlData.Current.Items) { if (item.ID == id) { _xml = item; break; } } //create our groups var groups = new List <ItemGroupVM>(); var enumNames = Enum.GetNames(typeof(ItemCategories)); Array.Sort <String>(enumNames); //check enum support foreach (string ename in enumNames) { var etype = Enum.Parse(typeof(ItemCategories), ename); int eint = (int)etype; if (((int)categories & eint) == eint) { //create the group for this supported type ItemGroupVM vm = new ItemGroupVM(ename, this); if (vm.Items.Count > 0) { groups.Add(vm); } } } AllGroups = new UpdatableCollection <ItemGroupVM>(groups); }
public override void Init() { cbxUIStyle.SelectedIndex = (int)FDesigner.UIStyle; btnUp.Image = Res.GetImage(208); btnDown.Image = Res.GetImage(209); XmlItem pluginsItem = Config.Root.FindItem("Plugins"); for (int i = 0; i < pluginsItem.Count; i++) { XmlItem xi = pluginsItem[i]; AddPlugin(xi.GetProp("Name")); } lblNote.Width = tab2.Width - lblNote.Left * 2; lblNote.Height = tab2.Height - lblNote.Top; lbPlugins_SelectedIndexChanged(this, EventArgs.Empty); }
/// <summary> /// Assigns values from another source. /// </summary> /// <remarks> /// <b>Note:</b> this method is relatively slow because it serializes /// an object to the xml and then deserializes it. /// </remarks> /// <param name="source">Source to assign from.</param> public void BaseAssign(Base source) { bool saveAncestor = source.IsAncestor; source.SetAncestor(false); using (XmlItem xml = new XmlItem()) using (FRWriter writer = new FRWriter(xml)) using (FRReader reader = new FRReader(Report, xml)) { writer.SaveChildren = false; writer.Write(source, this); reader.Read(this); } Alias = source.Alias; OriginalComponent = source.OriginalComponent; source.SetAncestor(saveAncestor); }
/// <inheritdoc/> public override bool Run(Designer designer) { if (!designer.CreateEmptyReport()) { return(false); } using (LabelWizardForm form = new LabelWizardForm()) { form.InitWizard(designer.ActiveReport); bool result = form.ShowDialog() == DialogResult.OK; if (result) { FSelectedManufacturer = form.SelectedManufacturer; FSelectedLabelName = form.SelectedLabelName; FSelectedLabelParameters = form.SelectedLabelParameters; } return(result); } }
private void ReadConnections() { if (Config.DesignerSettings.CustomConnections.Count > 0) { FConnections.Deserialize(Config.DesignerSettings.CustomConnections); } else { XmlItem root = Config.Root.FindItem("Designer").FindItem("LastConnections"); using (FRReader reader = new FRReader(null, root)) { reader.Read(FConnections); } } if (FConnections.Count > 0) { Connection = FConnections[0]; } }
private bool DoAdd(Base c, XmlItem item) { if (c == null) { return(false); } ReportEngine engine = Report.Engine; bool isRunning = Report.IsRunning && engine != null; if (c is ReportComponentBase) { if (isRunning && !engine.CanPrint(c as ReportComponentBase)) { return(false); } } item = item.Add(); using (FRWriter writer = new FRWriter(item)) { writer.SerializeTo = SerializeTo.Preview; writer.SaveChildren = false; writer.BlobStore = preparedPages.BlobStore; writer.Write(c); } if (isRunning) { engine.AddObjectToProcess(c, item); } if ((c.Flags & Flags.CanWriteChildren) == 0) { ObjectCollection childObjects = c.ChildObjects; foreach (Base obj in childObjects) { DoAdd(obj, item); } } return(true); }
public void PasteObjects(XmlItem objects, float deltaX, float deltaY) { if (objects.Count > 0) { while (objects.Count > 0) { XmlItem obj = objects[0]; // shift the object's location float objX = (obj.GetProp("l") != "") ? Converter.StringToFloat(obj.GetProp("l")) : 0; float objY = (obj.GetProp("t") != "") ? Converter.StringToFloat(obj.GetProp("t")) : 0; obj.SetProp("l", Converter.ToString(objX + deltaX)); obj.SetProp("t", Converter.ToString(objY + deltaY)); // add object to a page xmlItem.AddItem(obj); } } }
/// <summary> /// Gets the item or create default. /// </summary> /// <returns>The item or create default.</returns> /// <param name="key">Key.</param> protected XmlItem GetItemOrCreateDefault(string key) { var item = _XML_STORE[key]; if(null == item) { item = new XmlItem(); item.Key = key; _XML_STORE.Items.Add(item); } return item; }