コード例 #1
0
        private void Method5Preview_Click()
        {
            string   name = "Method" + 5 + "Grid";
            object   ctrl = this.FindName(name);
            DataGrid grid = ctrl as DataGrid;

            if (grid == null)
            {
                return;
            }
            string theval   = "";
            string sepvalue = "";

            try
            { sepvalue = this.Method5Value.Text.Replace("(space)", " "); }
            catch {}

            for (int i = 0; i < grid.Items.Count; i++)
            {
                ConcatRow row = grid.Items.GetItemAt(i) as ConcatRow;
                if (row != null)
                {
                    if (row.Checked == true)
                    {
                        theval += row.Name + sepvalue;
                    }
                }
            }
            if (theval.EndsWith(sepvalue))
            {
                theval = theval.Substring(0, theval.LastIndexOf(sepvalue));
            }
            setPreviewRows(theval);
        }
コード例 #2
0
        private void Method5Check_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox check = sender as CheckBox;

            if (Method5Grid.SelectedIndex == -1)
            {
                return;
            }

            if (check != null)
            {
                for (int i = 0; i < Method5Grid.Items.Count; i++)
                {
                    if (i == Method5Grid.SelectedIndex)
                    {
                        object    item = Method5Grid.Items.GetItemAt(i);
                        ConcatRow row  = item as ConcatRow;
                        if (row != null)
                        {
                            bool chk = (check.IsChecked.HasValue) ? check.IsChecked.Value : false;
                            row.Checked = chk;
                            if (chk == true)
                            {
                                _concat.Add(row.Name);
                            }
                            else
                            {
                                _concat.Remove(row.Name);
                            }
                            setConcatValues();
                        }
                    }
                }
            }
        }
コード例 #3
0
        private void saveM5()
        {
            // Concat
            System.Xml.XmlNodeList nodes = getFieldNodes(this.FieldGrid.SelectedIndex + 1);
            if (nodes != null)
            {
                try
                {
                    nodes[0].SelectSingleNode("Method").InnerText = getMethodVal();
                    System.Xml.XmlNode node = nodes[0].LastChild.SelectSingleNode("Concatenate");
                    trimNodes(nodes, 3);
                    addNode(nodes, "Separator", Method5Value.Text);

                    DataGrid grid = this.Method5Grid as DataGrid;
                    if (grid == null)
                    {
                        return;
                    }
                    System.Xml.XmlNode cnodes = _xml.CreateElement("cFields");
                    nodes[0].AppendChild(cnodes);

                    for (int i = 0; i < grid.Items.Count; i++)
                    {
                        ConcatRow row = grid.Items.GetItemAt(i) as ConcatRow;
                        if (row != null)
                        {
                            if (row.Checked == true)
                            {
                                System.Xml.XmlNode cnode = _xml.CreateElement("cField");

                                System.Xml.XmlNode nm = _xml.CreateElement("Name");
                                nm.InnerText = row.Name;
                                cnode.AppendChild(nm);

                                // not writing these nodes since assuming row order and only writing checked items.
                                //System.Xml.XmlNode chk = _xml.CreateElement("Checked");
                                //chk.InnerText = "True";
                                //cnode.AppendChild(chk);

                                //System.Xml.XmlNode seq = _xml.CreateElement("Sequence");
                                //chk.InnerText = i.ToString(); // write in row order
                                //cnode.AppendChild(chk);

                                cnodes.AppendChild(cnode);
                            }
                        }
                    }
                    saveFieldGrid();
                }
                catch { }
            }
        }