示例#1
0
        private void ctxMenuExport_Click(object sender, EventArgs e)
        {
            // Check if there are any entries
            if (lstDriverStoreEntries.Objects != null)
            {
                try
                {
                    List <DriverStoreEntry> ldse = lstDriverStoreEntries.Objects as List <DriverStoreEntry>;
                    IExport exporter             = new CSVExporter(); // TODO: Factory?? Change this when we add support for
                                                                      // direct Excel export
                    string fileName = exporter.Export(ldse);

                    if (!string.IsNullOrEmpty(fileName))
                    {
                        string message = $"Contents saved to {fileName}. Export Completed.";
                        MessageBox.Show(message);
                        ShowStatus(message, Status.Normal);
                    }
                }
                catch (Exception ex)
                {
                    string message = $"Export failed: {ex.ToString()}";
                    MessageBox.Show(message);
                    ShowStatus(message, Status.Error);
                }
            }
        }
示例#2
0
        private void ExportList()
        {
            // Check if there are any entries
            if (this.lstDriverStoreEntries.Objects != null)
            {
                try
                {
                    List <DriverStoreEntry> ldse = this.lstDriverStoreEntries.Objects as List <DriverStoreEntry>;
                    IExport exporter             = new CSVExporter(); // TODO: Factory?? Change this when we add support for
                                                                      // direct Excel export
                    string fileName = exporter.Export(ldse);

                    if (!string.IsNullOrEmpty(fileName))
                    {
                        string message = string.Format(Language.Export_Complete, fileName);
                        MessageBox.Show(message);
                        this.ShowStatus(message, Status.Normal);
                    }
                }
                catch (Exception ex)
                {
                    string message = string.Format(Language.Export_Failed, ex);
                    MessageBox.Show(message);
                    this.ShowStatus(message, Status.Error);
                }
            }
        }
示例#3
0
 private void ctxMenuExport_Click(object sender, EventArgs e)
 {
     // Check if there are any entries
     if ((lstDriverStoreEntries.Objects != null))
     {
         try
         {
             List <DriverStoreEntry> ldse = lstDriverStoreEntries.Objects as List <DriverStoreEntry>;
             IExport exporter             = new CSVExporter(); // TODO: Factory?? Change this when we add support for
                                                               // direct Excel export
             exporter.Export(ldse);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Export failed: " + ex.Message);
         }
     }
 }
示例#4
0
 private void ctxtMenuExport_Click(object sender, EventArgs e)
 {
     // Check if there are any entries
     if ((lstDriverStoreEntries.Objects != null))
     {
         try
         {
             List<DriverStoreEntry> ldse = lstDriverStoreEntries.Objects as List<DriverStoreEntry>;
             IExport exporter = new CSVExporter();   // TODO: Factory?? Change this when we add support for 
                                                     // direct Excel export
             exporter.Export(ldse);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Export failed: " + ex.Message);
         }
     }  
 }