本文整理汇总了C#中CameraControl.Core.Classes.FileItem.RemoveThumbs方法的典型用法代码示例。如果您正苦于以下问题:C# FileItem.RemoveThumbs方法的具体用法?C# FileItem.RemoveThumbs怎么用?C# FileItem.RemoveThumbs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CameraControl.Core.Classes.FileItem
的用法示例。
在下文中一共展示了FileItem.RemoveThumbs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public bool Execute(FileItem item, AutoExportPluginConfig configData)
{
configData.IsRedy = false;
configData.IsError = false;
var filename = item.FileName;
var conf = new TransformPluginViewModel(configData);
var outfile = Path.GetTempFileName();
outfile = PhotoUtils.ReplaceExtension(outfile, Path.GetExtension(filename));
outfile = AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);
if (conf.CreateNew)
{
string newFile = Path.Combine(Path.GetDirectoryName(filename),
Path.GetFileNameWithoutExtension(filename) + "_transformed" + ".jpg");
newFile = PhotoUtils.GetNextFileName(newFile);
File.Copy(outfile, newFile, true);
if (ServiceProvider.Settings.DefaultSession.GetFile(newFile) == null)
{
Application.Current.Dispatcher.Invoke(new Action(() =>
{
FileItem im = new FileItem(newFile);
im.Transformed = true;
var i = ServiceProvider.Settings.DefaultSession.Files.IndexOf(item);
if (ServiceProvider.Settings.DefaultSession.Files.Count - 1 == i)
{
ServiceProvider.Settings.DefaultSession.Files.Add(im);
}
else
{
ServiceProvider.Settings.DefaultSession.Files.Insert(i + 1, im);
}
}));
}
}
else
{
// wait for file to be not locked
PhotoUtils.WaitForFile(filename);
File.Copy(outfile, filename, true);
item.IsLoaded = false;
item.RemoveThumbs();
item.Transformed = true;
}
// remove unused file
if (outfile != item.FileName)
{
PhotoUtils.WaitForFile(outfile);
File.Delete(outfile);
}
configData.IsRedy = true;
return true;
}
示例2: Execute
public bool Execute(FileItem item, AutoExportPluginConfig configData)
{
configData.IsRedy = false;
configData.IsError = false;
var filename = item.FileName;
var outfile = Path.GetTempFileName();
AutoExportPluginHelper.ExecuteTransformPlugins(item, configData, outfile);
// wait for file to be not locked
PhotoUtils.WaitForFile(filename);
File.Copy(outfile, filename, true);
File.Delete(outfile);
item.IsLoaded = false;
item.RemoveThumbs();
// remove unused file
if (outfile != item.FileName)
{
PhotoUtils.WaitForFile(outfile);
File.Delete(outfile);
}
configData.IsRedy = true;
return true;
}
示例3: PhotoCaptured
//.........这里部分代码省略.........
{
_selectedItem = session.GetNewFileItem(fileName);
_selectedItem.BackupFileName = backupfile;
_selectedItem.Series = session.Series;
_selectedItem.AddTemplates(eventArgs.CameraDevice, session);
ServiceProvider.Database.Add(new DbFile(_selectedItem, eventArgs.CameraDevice.DisplayName,
eventArgs.CameraDevice.SerialNumber, session.Name));
}
catch (Exception ex)
{
}
}));
foreach (AutoExportPluginConfig plugin in ServiceProvider.Settings.DefaultSession.AutoExportPluginConfigs)
{
if(!plugin.IsEnabled)
continue;
var pl = ServiceProvider.PluginManager.GetAutoExportPlugin(plugin.Type);
try
{
pl.Execute(_selectedItem, plugin);
ServiceProvider.Analytics.PluginExecute(plugin.Type);
Log.Debug("AutoexportPlugin executed " + plugin.Type);
}
catch (Exception ex)
{
plugin.IsError = true;
plugin.Error = ex.Message;
plugin.IsRedy = true;
Log.Error("Error to apply plugin", ex);
}
}
Dispatcher.Invoke(() =>
{
_selectedItem.RemoveThumbs();
session.Add(_selectedItem);
ServiceProvider.OnFileTransfered(_selectedItem);
});
if (ServiceProvider.Settings.MinimizeToTrayIcon && !IsVisible && !ServiceProvider.Settings.HideTrayNotifications)
{
MyNotifyIcon.HideBalloonTip();
MyNotifyIcon.ShowBalloonTip("Photo transfered", fileName, BalloonIcon.Info);
}
ServiceProvider.DeviceManager.LastCapturedImage[eventArgs.CameraDevice] = fileName;
//select the new file only when the multiple camera support isn't used to prevent high CPU usage on raw files
if (ServiceProvider.Settings.AutoPreview &&
!ServiceProvider.WindowsManager.Get(typeof (MultipleCameraWnd)).IsVisible &&
!ServiceProvider.Settings.UseExternalViewer)
{
if ((Path.GetExtension(fileName).ToLower() == ".jpg" && ServiceProvider.Settings.AutoPreviewJpgOnly) ||
!ServiceProvider.Settings.AutoPreviewJpgOnly)
{
if ((DateTime.Now - _lastLoadTime).TotalSeconds < 4)
{
_selectiontimer.Stop();
_selectiontimer.Start();
}
else
{
ServiceProvider.WindowsManager.ExecuteCommand(WindowsCmdConsts.Select_Image, _selectedItem);
}
}
}
_lastLoadTime = DateTime.Now;
//ServiceProvider.Settings.Save(session);
StaticHelper.Instance.SystemMessage = TranslationStrings.MsgPhotoTransferDone;
eventArgs.CameraDevice.IsBusy = false;
//show fullscreen only when the multiple camera support isn't used
if (ServiceProvider.Settings.Preview &&
!ServiceProvider.WindowsManager.Get(typeof (MultipleCameraWnd)).IsVisible &&
!ServiceProvider.Settings.UseExternalViewer)
ServiceProvider.WindowsManager.ExecuteCommand(WindowsCmdConsts.FullScreenWnd_ShowTimed);
if (ServiceProvider.Settings.UseExternalViewer &&
File.Exists(ServiceProvider.Settings.ExternalViewerPath))
{
string arg = ServiceProvider.Settings.ExternalViewerArgs;
arg = arg.Contains("%1") ? arg.Replace("%1", fileName) : arg + " " + fileName;
PhotoUtils.Run(ServiceProvider.Settings.ExternalViewerPath, arg, ProcessWindowStyle.Normal);
}
if (ServiceProvider.Settings.PlaySound)
{
PhotoUtils.PlayCaptureSound();
}
Log.Debug("Photo transfer done.");
}
catch (Exception ex)
{
eventArgs.CameraDevice.IsBusy = false;
StaticHelper.Instance.SystemMessage =TranslationStrings.MsgPhotoTransferError+" "+ ex.Message;
Log.Error("Transfer error !", ex);
}
// not indicated to be used
GC.Collect();
//GC.WaitForPendingFinalizers();
}