Ejemplo n.º 1
0
        /// <summary>
        /// Handler for the "Edit Exisiting Data" button
        /// </summary>
        private void m_button_EditExistingSimple_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ///Given a guid corresponding to a Schema with Entity data in the current document's ProjectInformation element,
                ///change the entity data to new data, (assuming that the schemas and schema guids are identical).
                StorageCommand.EditExistingData(m_Document.ProjectInformation, new Guid(m_textBox_SchemaId.Text), out m_SchemaWrapper);
            }
            catch (Exception ex)
            {
                TaskDialog.Show("ExtensibleStorage Manager", "Could not extract data from Schema.  " + ex.ToString());
                return;
            }

            UpdateUI();

            ///Display the schema fields and new data in a separate dialog.
            ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
            string schemaData = this.m_SchemaWrapper.ToString();
            string entityData = this.m_SchemaWrapper.GetSchemaEntityData(m_Document.ProjectInformation.GetEntity(m_SchemaWrapper.GetSchema()));
            string allData    = "Schema: " + Environment.NewLine + schemaData + Environment.NewLine + Environment.NewLine + "Entity" + Environment.NewLine + entityData;

            dataDialog.SetData(allData);
            dataDialog.ShowDialog();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handler for the "Create Schema from XML" button
        /// </summary>
        private void m_button_CreateSchemaFromXml_Click(object sender, RoutedEventArgs e)
        {
            //Prompt the user for an xml file containing a serialized schema.
            Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
            ofd.InitialDirectory = GetStartingXmlPath();
            ofd.DefaultExt       = ".xml";
            ofd.Filter           = "SchemaWrapper Xml files (*.xml)|*.xml";
            Nullable <bool> result = ofd.ShowDialog();

            if ((result.HasValue) && (result == true))
            {
                try
                {
                    //Given an xml file containing schema data, create a new SchemaWrapper object
                    StorageCommand.ImportSchemaFromXml(ofd.FileName, out m_SchemaWrapper);
                }

                catch (Exception ex)
                {
                    TaskDialog.Show("ExtensibleStorage Manager", "Could not import Schema from Xml.  " + ex.ToString());
                    return;
                }
                //Display the top level schema data in the dialog.
                UpdateUI();

                //Display the field data of the schema in a separate dialog.
                ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
                dataDialog.SetData(m_SchemaWrapper.ToString());
                dataDialog.ShowDialog();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a sample schema, populates it with sample data, and saves it to an XML file
        /// </summary>
        /// <param name="schemaComplexity">The example schema to create</param>
        private void CreateSetSave(SampleSchemaComplexity schemaComplexity)
        {
            //Get read-write access levels and schema and application Ids from the active dialog
            AccessLevel read;
            AccessLevel write;

            GetUIAccessLevels(out read, out write);
            if (!ValidateGuids())
            {
                TaskDialog.Show("ExtensibleStorage Manager", "Invalid Schema or ApplicationId Guid.");
                return;
            }

            //Get a pathname for an XML file from the user.
            Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
            sfd.DefaultExt       = ".xml";
            sfd.Filter           = "SchemaWrapper Xml files (*.xml)|*.xml";
            sfd.InitialDirectory = GetStartingXmlPath();

            sfd.FileName = this.m_textBox_SchemaName.Text + "_" + this.m_textBox_SchemaVendorId.Text + "___" + this.m_textBox_SchemaId.Text.Substring(31) + ".xml";

            Nullable <bool> result = sfd.ShowDialog();

            if ((result.HasValue) && (result == true))
            {
                try
                {
                    //Create a new sample SchemaWrapper, schema, and Entity and store it in the current document's ProjectInformation element.
                    m_SchemaWrapper = StorageCommand.CreateSetAndExport(m_Document.ProjectInformation, sfd.FileName, new Guid(this.m_textBox_SchemaId.Text), read, write, this.m_textBox_SchemaVendorId.Text, this.m_textBox_SchemaApplicationId.Text, this.m_textBox_SchemaName.Text, this.m_textBox_SchemaDocumentation.Text, schemaComplexity);
                }
                catch (Exception ex)
                {
                    TaskDialog.Show("ExtensibleStorage Manager", "Could not Create Schema.  " + ex.ToString());
                    return;
                }


                UpdateUI();

                //Display the schema fields and sample data we just created in a dialog.
                ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
                string schemaData = this.m_SchemaWrapper.ToString();
                string entityData = this.m_SchemaWrapper.GetSchemaEntityData(m_Document.ProjectInformation.GetEntity(m_SchemaWrapper.GetSchema()));
                string allData    = "Schema: " + Environment.NewLine + schemaData + Environment.NewLine + Environment.NewLine + "Entity" + Environment.NewLine + entityData;
                dataDialog.SetData(allData);
                dataDialog.ShowDialog();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handler for the "Create Wrapper from Schema" button
        /// </summary>
        private void m_button_CreateWrapperFromSchema_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Given a Guid that corresponds to a schema that already exists in a document, create a SchemaWrapper
                //from it and display its top-level data in the dialog.
                StorageCommand.CreateWrapperFromSchema(new Guid(m_textBox_SchemaId.Text), out m_SchemaWrapper);
                UpdateUI();
            }

            catch (Exception ex)
            {
                TaskDialog.Show("ExtensibleStorage Manager", "Could not Create SchemaWrapper from Schema.  " + ex.ToString());
                return;
            }
            //Display all of the schema's field data in a separate dialog.
            ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
            dataDialog.SetData(m_SchemaWrapper.ToString());
            dataDialog.ShowDialog();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handler for the "Look up and extract" button
        /// </summary>
        private void m_button_LookupExtract_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //Given a Guid that corresponds to a schema that already exists in a document, create a SchemaWrapper
                //from it and display its top-level data in the dialog.
                StorageCommand.LookupAndExtractData(m_Document.ProjectInformation, new Guid(m_textBox_SchemaId.Text), out m_SchemaWrapper);
            }
            catch (Exception ex)
            {
                TaskDialog.Show("ExtensibleStorage Manager", "Could not extract data from Schema.  " + ex.ToString());
                return;
            }
            UpdateUI();
            ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();

            //Get and display the schema field data and the actual entity data in a separate dialog.
            string schemaData = this.m_SchemaWrapper.ToString();
            string entityData = this.m_SchemaWrapper.GetSchemaEntityData(m_Document.ProjectInformation.GetEntity(m_SchemaWrapper.GetSchema()));
            string allData    = "Schema: " + Environment.NewLine + schemaData + Environment.NewLine + Environment.NewLine + "Entity" + Environment.NewLine + entityData;

            dataDialog.SetData(allData);
            dataDialog.ShowDialog();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a sample schema, populates it with sample data, and saves it to an XML file
        /// </summary>
        /// <param name="schemaComplexity">The example schema to create</param>
        private void CreateSetSave(SampleSchemaComplexity schemaComplexity)
        {
            //Get read-write access levels and schema and application Ids from the active dialog
             AccessLevel read;
             AccessLevel write;
             GetUIAccessLevels(out read, out write);
             if (!ValidateGuids())
             {
            TaskDialog.Show("ExtensibleStorage Manager", "Invalid Schema or ApplicationId Guid.");
            return;
             }

             //Get a pathname for an XML file from the user.
             Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
             sfd.DefaultExt = ".xml";
             sfd.Filter = "SchemaWrapper Xml files (*.xml)|*.xml";
             sfd.InitialDirectory = GetStartingXmlPath();

             sfd.FileName = this.m_textBox_SchemaName.Text + "_" + this.m_textBox_SchemaVendorId.Text + "___" + this.m_textBox_SchemaId.Text.Substring(31) + ".xml";

             Nullable<bool> result = sfd.ShowDialog();

             if ((result.HasValue) && (result == true))
             {
            try
            {
               //Create a new sample SchemaWrapper, schema, and Entity and store it in the current document's ProjectInformation element.
               m_SchemaWrapper = StorageCommand.CreateSetAndExport(m_Document.ProjectInformation, sfd.FileName, new Guid(this.m_textBox_SchemaId.Text), read, write, this.m_textBox_SchemaVendorId.Text, this.m_textBox_SchemaApplicationId.Text, this.m_textBox_SchemaName.Text, this.m_textBox_SchemaDocumentation.Text, schemaComplexity);
            }
            catch (Exception ex)
            {
               TaskDialog.Show("ExtensibleStorage Manager", "Could not Create Schema.  " + ex.ToString());
               return;
            }

            UpdateUI();

            //Display the schema fields and sample data we just created in a dialog.
            ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
            string schemaData = this.m_SchemaWrapper.ToString();
            string entityData = this.m_SchemaWrapper.GetSchemaEntityData(m_Document.ProjectInformation.GetEntity(m_SchemaWrapper.GetSchema()));
            string allData = "Schema: " + Environment.NewLine + schemaData + Environment.NewLine + Environment.NewLine + "Entity" + Environment.NewLine + entityData;
            dataDialog.SetData(allData);
            dataDialog.ShowDialog();
             }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Handler for the "Look up and extract" button
        /// </summary>
        private void m_button_LookupExtract_Click(object sender, RoutedEventArgs e)
        {
            try
             {
            //Given a Guid that corresponds to a schema that already exists in a document, create a SchemaWrapper
            //from it and display its top-level data in the dialog.
            StorageCommand.LookupAndExtractData(m_Document.ProjectInformation, new Guid(m_textBox_SchemaId.Text), out m_SchemaWrapper);
             }
             catch (Exception ex)
             {
            TaskDialog.Show("ExtensibleStorage Manager", "Could not extract data from Schema.  " + ex.ToString());
            return;
             }
             UpdateUI();
             ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();

             //Get and display the schema field data and the actual entity data in a separate dialog.
             string schemaData = this.m_SchemaWrapper.ToString();
             string entityData = this.m_SchemaWrapper.GetSchemaEntityData(m_Document.ProjectInformation.GetEntity(m_SchemaWrapper.GetSchema()));
             string allData = "Schema: " + Environment.NewLine + schemaData + Environment.NewLine + Environment.NewLine + "Entity" + Environment.NewLine + entityData;

             dataDialog.SetData(allData);
             dataDialog.ShowDialog();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Handler for the "Edit Exisiting Data" button
        /// </summary>
        private void m_button_EditExistingSimple_Click(object sender, RoutedEventArgs e)
        {
            try
             {
            ///Given a guid corresponding to a Schema with Entity data in the current document's ProjectInformation element,
            ///change the entity data to new data, (assuming that the schemas and schema guids are identical).
            StorageCommand.EditExistingData(m_Document.ProjectInformation, new Guid(m_textBox_SchemaId.Text), out m_SchemaWrapper);
             }
             catch (Exception ex)
             {
            TaskDialog.Show("ExtensibleStorage Manager", "Could not extract data from Schema.  " + ex.ToString());
            return;
             }

             UpdateUI();

             ///Display the schema fields and new data in a separate dialog.
             ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
             string schemaData = this.m_SchemaWrapper.ToString();
             string entityData = this.m_SchemaWrapper.GetSchemaEntityData(m_Document.ProjectInformation.GetEntity(m_SchemaWrapper.GetSchema()));
             string allData = "Schema: " + Environment.NewLine + schemaData + Environment.NewLine + Environment.NewLine + "Entity" + Environment.NewLine + entityData;

             dataDialog.SetData(allData);
             dataDialog.ShowDialog();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handler for the "Create Wrapper from Schema" button
        /// </summary>
        private void m_button_CreateWrapperFromSchema_Click(object sender, RoutedEventArgs e)
        {
            try
             {
            //Given a Guid that corresponds to a schema that already exists in a document, create a SchemaWrapper
            //from it and display its top-level data in the dialog.
            StorageCommand.CreateWrapperFromSchema(new Guid(m_textBox_SchemaId.Text), out m_SchemaWrapper);
            UpdateUI();
             }

             catch (Exception ex)
             {
            TaskDialog.Show("ExtensibleStorage Manager", "Could not Create SchemaWrapper from Schema.  " + ex.ToString());
            return;
             }
             //Display all of the schema's field data in a separate dialog.
             ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
             dataDialog.SetData(m_SchemaWrapper.ToString());
             dataDialog.ShowDialog();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Handler for the "Create Schema from XML" button
        /// </summary>
        private void m_button_CreateSchemaFromXml_Click(object sender, RoutedEventArgs e)
        {
            //Prompt the user for an xml file containing a serialized schema.
             Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
             ofd.InitialDirectory = GetStartingXmlPath();
             ofd.DefaultExt = ".xml";
             ofd.Filter = "SchemaWrapper Xml files (*.xml)|*.xml";
             Nullable<bool> result = ofd.ShowDialog();

             if (( result.HasValue) && (result == true))
             {
            try
            {
               //Given an xml file containing schema data, create a new SchemaWrapper object
               StorageCommand.ImportSchemaFromXml(ofd.FileName, out m_SchemaWrapper);
            }

            catch (Exception ex)
            {
               TaskDialog.Show("ExtensibleStorage Manager", "Could not import Schema from Xml.  " + ex.ToString());
               return;
            }
            //Display the top level schema data in the dialog.
            UpdateUI();

            //Display the field data of the schema in a separate dialog.
            ExtensibleStorageManager.UIData dataDialog = new ExtensibleStorageManager.UIData();
            dataDialog.SetData(m_SchemaWrapper.ToString());
            dataDialog.ShowDialog();
             }
        }