Beispiel #1
0
        public static void WriteAll(this IFileConnector connector, IEnumerable <IFreeDocument> data)
        {
            Monitor.Enter(connector);//锁定,保持同步


            var r = connector.WriteData(data).LastOrDefault();

            Monitor.Exit(connector);//锁定,保持同步
            Thread.Sleep(200);
        }
Beispiel #2
0
        public void SaveFile(DataCollection dataCollection, string path = null, string format = null)
        {
            IFileConnector exporter = null;

            if (format != null)
            {
                exporter = PluginProvider.GetObjectInstance <IFileConnector>(format);
            }
            else
            {
                exporter = FileConnector.SmartGetExport(path);
            }

            if (exporter == null)
            {
                return;
            }
            var data = dataCollection.ComputeData;


            exporter.FileName = path;
            processManager.CurrentProcessTasks.Add(
                TemporaryTask <FreeDocument> .AddTempTask(dataCollection + GlobalHelper.Get("key_252"),
                                                          exporter.WriteData(data), null, result =>
            {
                if (MainDescription.IsUIForm && string.IsNullOrEmpty(exporter.FileName) == false)
                {
                    if (
                        MessageBox.Show(GlobalHelper.Get("key_253"), GlobalHelper.Get("key_99"),
                                        MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        try
                        {
                            System.Diagnostics.Process.Start(exporter.FileName);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(GlobalHelper.Get("key_254") + ex.Message);
                        }
                    }
                }
            }, data.Count, notifyInterval: 1000));
        }
Beispiel #3
0
 public static void WriteAll(this IFileConnector connector, IEnumerable <IFreeDocument> data)
 {
     var r = connector.WriteData(data).LastOrDefault();
 }