예제 #1
0
        private void tsbExport_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog { Title = "Select where to save the file", Filter = "Csv file|*.csv" };
            if (sfd.ShowDialog(ParentForm) != DialogResult.OK)
            {
                return;
            }

            listLog.Items.Clear();

            var settings = new ImportFileSettings
            {
                FirstEntity = ((EntityInfo)cbbFirstEntity.SelectedItem).Metadata.LogicalName,
                FirstAttributeIsGuid = rdbFirstGuid.Checked,
                FirstAttributeName = ((AttributeInfo)cbbFirstEntityAttribute.SelectedItem).Metadata.LogicalName,
                Relationship = ((RelationshipInfo)cbbRelationship.SelectedItem).Metadata.IntersectEntityName,
                SecondEntity = ((EntityInfo)cbbSecondEntity.SelectedItem).Metadata.LogicalName,
                SecondAttributeIsGuid = rdbSecondGuid.Checked,
                SecondAttributeName = ((AttributeInfo)cbbSecondEntityAttribute.SelectedItem).Metadata.LogicalName,
            };

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Exporting many to many relationship records...",
                AsyncArgument = new object[] { settings, sfd.FileName },
                Work = (bw, evt) =>
                {
                    var innerSettings = (ImportFileSettings)((object[])evt.Argument)[0];
                    var filePath = ((object[])evt.Argument)[1].ToString();
                    var ee = new ExportEngine(filePath, this.Service, innerSettings);
                    ee.RaiseError += ee_RaiseError;
                    ee.Export();
                },
                PostWorkCallBack = evt => { }
            });
        }
예제 #2
0
 void exportWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     var settings = (ImportFileSettings)((object[])e.Argument)[0];
     var filePath = ((object[])e.Argument)[1].ToString();
     var ee = new ExportEngine(filePath, service, settings);
     ee.RaiseError += ee_RaiseError;
     ee.Export();
 }