Пример #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (Directory.Exists(Application.StartupPath))
            {
                assemblies.Clear();
                namespaces.Clear();
                Sqo.Siaqodb siaqodb = new Sqo.Siaqodb(Application.StartupPath);
                try
                {
                    siaqodb.DropType <ReferenceItem>();
                    siaqodb.DropType <NamespaceItem>();
                    foreach (object o in listBox1.Items)
                    {
                        ReferenceItem refItem = o as ReferenceItem;
                        if (refItem == null)
                        {
                            refItem = new ReferenceItem(o.ToString());
                        }
                        assemblies.Add(refItem);
                        siaqodb.StoreObject(refItem);

                        if (File.Exists(refItem.Item))
                        {
                            try
                            {
                                File.Copy(refItem.Item, Application.StartupPath + Path.DirectorySeparatorChar + Path.GetFileName(refItem.Item), true);
                            }
                            catch
                            {
                            }
                        }
                    }
                    foreach (string s in textBox1.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        NamespaceItem nobj = new NamespaceItem(s);
                        namespaces.Add(nobj);
                        siaqodb.StoreObject(nobj);
                    }
                }
                finally
                {
                    siaqodb.Close();
                }
            }

            this.DialogResult = DialogResult.OK;
        }
Пример #2
0
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            if (System.IO.Directory.Exists(cmbDBPath.Text))
            {
                if (!cmbDBPath.Items.Contains(cmbDBPath.Text))
                {
                    cmbDBPath.Items.Add(cmbDBPath.Text);
                    SiaqodbConfigurator.EncryptedDatabase = false;
                    Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(AppDomain.CurrentDomain.BaseDirectory);

                    siaqodbConfig.StoreObject(new ConnectionItem(cmbDBPath.Text));
                    siaqodbConfig.Close();
                    EncryptionSettings.SetEncryptionSettings();//set back settings
                }
                siaqodb = Sqo.Internal._bs._b(cmbDBPath.Text);

                siaqodbList = siaqodb.GetAllTypes();
                treeView1.Items.Clear();
                ContextMenu cm    = new ContextMenu();
                MenuItem    mitem = new MenuItem();
                mitem.Header = "Load objects";
                cm.Items.Add(mitem);
                mitem.Click += new RoutedEventHandler(mitem_Click);
                foreach (Sqo.MetaType mt in siaqodbList)
                {
                    Sqo.Internal._bs._sdbfn(siaqodb, mt, mt.FileName);
                    ImageTreeViewItem nodeType = new ImageTreeViewItem();
                    nodeType.Tag             = mt;
                    nodeType.Text            = mt.Name;
                    nodeType.SelectedImage   = ImageTreeViewItem.Createimage(@"pack://*****:*****@"pack://application:,,/Resources/pubclass.gif");
                    nodeType.ContextMenu     = cm;

                    treeView1.Items.Add(nodeType);
                    foreach (Sqo.MetaField mf in mt.Fields)
                    {
                        ImageTreeViewItem nodeField = new ImageTreeViewItem();
                        //nodeField.Header = mf.Name + "(" + mf.FieldType.ToString() + ")";
                        if (mf.FieldType != null)
                        {
                            nodeField.Text = mf.Name + "(" + mf.FieldType.ToString() + ")";
                        }
                        else
                        {
                            nodeField.Text = mf.Name + "(ComplexType)";
                        }
                        nodeField.SelectedImage   = ImageTreeViewItem.Createimage(@"pack://*****:*****@"pack://application:,,/Resources/pubfield.gif");
                        nodeField.ContextMenu     = null;
                        nodeType.Items.Add(nodeField);
                    }
                }
                btnDBInfo.IsEnabled = true;
            }
            else
            {
                MessageBox.Show("Select a valid folder path!");
            }
        }
Пример #3
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            //GC.Collect();

            if (System.IO.Directory.Exists(cmbDBPath.Text))
            {
                if (!cmbDBPath.Items.Contains(cmbDBPath.Text))
                {
                    cmbDBPath.ComboBox.Items.Add(cmbDBPath.Text);
                    SiaqodbConfigurator.EncryptedDatabase = false;

                    Sqo.Siaqodb siaqodbConfig = new Sqo.Siaqodb(Application.StartupPath);

                    siaqodbConfig.StoreObject(new ConnectionItem(cmbDBPath.Text));
                    siaqodbConfig.Close();
                    EncryptionSettings.SetEncryptionSettings();//set back settings
                }
                siaqodb = Sqo.Internal._bs._b(cmbDBPath.Text);

                siaqodbList = siaqodb.GetAllTypes();
                treeView1.Nodes.Clear();
                foreach (Sqo.MetaType mt in siaqodbList)
                {
                    TreeNode nodeType = new TreeNode(mt.Name);
                    nodeType.Tag                = mt;
                    nodeType.ImageIndex         = 0;
                    nodeType.SelectedImageIndex = 0;
                    nodeType.ContextMenuStrip   = this.contextMenuStrip1;
                    treeView1.Nodes.Add(nodeType);
                    foreach (Sqo.MetaField mf in mt.Fields)
                    {
                        TreeNode nodeField = new TreeNode();
                        if (mf.FieldType != null)
                        {
                            nodeField.Text = mf.Name + "(" + mf.FieldType.ToString() + ")";
                        }
                        else
                        {
                            nodeField.Text = mf.Name + "(ComplexType)";
                        }
                        nodeField.ImageIndex         = 1;
                        nodeField.SelectedImageIndex = 1;
                        nodeType.Nodes.Add(nodeField);
                    }
                }
            }
            else
            {
                MessageBox.Show("Select a valid folder path!");
            }
        }