Esempio n. 1
0
            public override void LoadChildNodes()
            {
                //
                try {
                    //Clear existing child nodes (label templates)
                    base.Nodes.Clear();

                    //Create label template objects (inherit from TreeNode); add to node array
                    base.mChildNodes = new TreeNode[this.mLabelStore.Labels.LabelDetailTable.Rows.Count];
                    for (int i = 0; i < this.mLabelStore.Labels.LabelDetailTable.Rows.Count; i++)
                    {
                        LabelTemplate template = null;
                        try {
                            template = this.mLabelStore.NewLabelTemplate((LabelDS.LabelDetailTableRow) this.mLabelStore.Labels.LabelDetailTable.Rows[i]);
                            LabelTemplateNode node = new LabelTemplateNode(template.LabelType + " (" + template.PrinterType + ")", App.ICON_APP, App.ICON_APP, template);
                            base.mChildNodes[i] = node;
                            base.Nodes.Add(node);

                            //Cascade loading child nodes if this node is expanded (to get the + sign)
                            if (base.IsExpanded)
                            {
                                node.LoadChildNodes();
                            }
                        }
                        catch (Exception) { MessageBox.Show("Error on label template loading; continuing..."); }
                    }
                }
                catch (Exception ex) { throw new ApplicationException("Failed to load all child nodes for label store " + base.Text + ".", ex); }
            }
Esempio n. 2
0
        private System.ComponentModel.Container components = null;                      //Required designer variable
        #endregion

        //Interface
        public winLabel(LabelTemplateNode node, LabelMaker labelMaker)
        {
            //Constructor
            //Required for Windows Form Designer support
            InitializeComponent();
            #region Menu identities (used for onclick handlers)
            this.ctxRefresh.Text = MNU_REFRESH;
            this.ctxCut.Text     = MNU_CUT;
            this.ctxCopy.Text    = MNU_COPY;
            this.ctxPaste.Text   = MNU_PASTE;
            #endregion
            #region Window docking
            this.splitterH.MinExtra = this.splitterH.MinSize = 48;
            this.splitterH.Dock     = this.pnlBottom.Dock = DockStyle.Bottom;
            this.pnlTop.Dock        = DockStyle.Fill;
            this.Controls.AddRange(new Control[] { this.pnlTop, this.splitterH, this.pnlBottom });
            #endregion

            //Bind to template and register for template events
            this.mLabelTemplateNode = node;
            this.mLabelTemplateNode.LabelTemplate.TemplateChanged += new EventHandler(this.OnTemplateChanged);
            this.mLabelMaker = labelMaker;
            this.mLabelMaker.LabelValuesChanged += new EventHandler(OnLabelValuesChanged);
        }