Exemplo n.º 1
0
        private void loadSchemaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //  DateTime start = DateTime.Now;

            //load schema
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "Open Pivot Table Schema file";
            string s = GetFile("blue.appearance.xml");

            s = s.Substring(0, s.LastIndexOf(@"\"));
            dlg.InitialDirectory = s;
            dlg.Filter           = "Pivot Table Schema files (*.schema.xml)|*.schema.xml|All files (*.*)|*.*";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //   start = DateTime.Now;

                Application.DoEvents();// let the dialog close before loading schema
                try
                {
                    this.Cursor = Cursors.WaitCursor;
                    PivotSchema schema = PivotSchema.LoadXML(dlg.FileName);
                    pivotGridControl1.ApplySchema(schema);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }

            //  this.Text = this.Text + "  " + string.Format("Load time: {0} secs", ((TimeSpan)(DateTime.Now - start)).TotalSeconds);
            //  Console.WriteLine(this.Text);
        }
Exemplo n.º 2
0
        private void saveSchemaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //save schema
            SaveFileDialog saveFile = new SaveFileDialog();

            saveFile.FileName   = "Untitled";
            saveFile.DefaultExt = "*.schema.xml";
            saveFile.Filter     = "Pivot Table Schema files (*.schema.xml)|*.schema.xml|All files (*.*)|*.*";

            // get a file name from the user
            if (saveFile.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    PivotSchema schema = pivotGridControl1.InitSchema();
                    schema.SaveXML(saveFile.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }