本文整理汇总了C#中ChangeAction类的典型用法代码示例。如果您正苦于以下问题:C# ChangeAction类的具体用法?C# ChangeAction怎么用?C# ChangeAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChangeAction类属于命名空间,在下文中一共展示了ChangeAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddToQueue
/// <summary>
/// Creates the SyncQueueItem from the given data and adds it to the sync queue
/// </summary>
private void AddToQueue(FileSystemEventArgs e, ChangeAction action)
{
var isFile = Common.PathIsFile(e.FullPath);
// ignore directory changes
if (!isFile && action == ChangeAction.changed) return;
var queueItem = new SyncQueueItem(controller)
{
Item = new ClientItem
{
Name = e.Name,
FullPath = e.FullPath,
Type = isFile ? ClientItemType.File : ClientItemType.Folder,
Size = (isFile && action != ChangeAction.deleted) ? new FileInfo(e.FullPath).Length : 0x0,
LastWriteTime = File.GetLastWriteTime(e.FullPath)
},
SyncTo = SyncTo.Remote,
ActionType = action
};
if (action == ChangeAction.renamed)
{
var args = e as RenamedEventArgs;
queueItem.Item.FullPath = args.OldFullPath;
queueItem.Item.NewFullPath = args.FullPath;
}
// Send to the sync queue
controller.SyncQueue.Add(queueItem);
}
示例2: Validate
/// <summary>
/// Validates this instance.
/// </summary>
/// <param name="dao">The DAO for additional data validation.</param>
/// <param name="changeAction">The change action.</param>
internal override void Validate(GenericDao dao, ChangeAction changeAction)
{
// Perform custom validation
if (changeAction == ChangeAction.Update)
{
this.ValidateGreaterThanZero(() => this.ReportGenerationQueueId);
}
if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
{
//// If (Enum.IsDefined(typeof(Enums.ReportStatus), this.ReportGenerationStatus))
////{
//// this.Errors.Add("The report generation status is invalid");
////}
Regex periodRegex = new Regex(@"^\d{6,6}$");
if (!periodRegex.IsMatch(this.Period.ToString()))
{
this.Errors.Add("The report period is not a valid period");
}
Regex quarterNameRegex = new Regex("^Q[0-3]$");
if (this.ReforecastQuarterName == null)
{
this.Errors.Add("The reforecast quarter cannot be empty");
}
else if (!quarterNameRegex.IsMatch(this.ReforecastQuarterName))
{
this.Errors.Add("The reforecast quarter is not a valid period");
}
}
}
示例3: Show
/// <summary>
/// Shows a notification regarding an action on one file OR folder
/// </summary>
/// <param name="name">The name of the file or folder</param>
/// <param name="ca">The ChangeAction</param>
/// <param name="file">True if file, False if Folder</param>
public static void Show(string name, ChangeAction ca, bool file)
{
if (!Settings.General.Notifications) return;
name = Common._name(name);
InvokeNotificationReady(null, new NotificationArgs { Title = Common.Languages[ca, file], Text = name });
}
示例4: RaiseComponentsChanged
protected void RaiseComponentsChanged( ComponentModel componentModel, ChangeAction action )
{
var handler = ComponentsChanged;
if ( handler != null )
{
handler( this, new ComponentsChangedEventArgs( componentModel, action ) );
}
}
示例5: OnValidate
partial void OnValidate(ChangeAction action)
{
if (!IsValid)
{
RuleViolation first = GetRuleViolations().First();
throw new RuleViolationException(first.ErrorMessage);
}
}
示例6: Validate
/// <summary>
/// Validates this instance.
/// </summary>
/// <param name="dao">The DAO for additional data validation.</param>
/// <param name="changeAction">The change action.</param>
internal override void Validate(GenericDao dao, ChangeAction changeAction)
{
// Perform custom validation
if (changeAction == ChangeAction.Update)
{
this.ValidateGreaterThanZero(() => this.ReportParameterActivityTypeId);
}
}
示例7: Show
/// <summary>
/// Shows a notification that a file or folder was renamed.
/// </summary>
/// <param name="name">The old name of the file/folder</param>
/// <param name="ca">file/folder ChangeAction, should be ChangeAction.renamed</param>
/// /// <param name="newname">The new name of the file/folder</param>
public static void Show(string name, ChangeAction ca, string newname)
{
if (!Settings.General.Notifications) return;
name = Common._name(name);
newname = Common._name(newname);
string body = string.Format(Common.Languages[ChangeAction.renamed, true], name, newname);
NotificationReady.SafeInvoke(null, new NotificationArgs { Text = body });
}
示例8: Show
/// <summary>
/// Shows a notification that a file or folder was renamed.
/// </summary>
/// <param name="name">The old name of the file/folder</param>
/// <param name="ca">file/folder ChangeAction, should be ChangeAction.renamed</param>
/// /// <param name="newname">The new name of the file/folder</param>
public static void Show(string name, ChangeAction ca, string newname)
{
if (!Settings.settingsGeneral.Notifications) return;
name = Common._name(name);
newname = Common._name(newname);
string body = string.Format(Get_Message(ChangeAction.renamed, true), name, newname);
InvokeNotificationReady(null, new NotificationArgs { Text = body });
}
示例9: Show
/// <summary>
/// Shows a notification regarding an action on one file OR folder
/// </summary>
/// <param name="name">The name of the file or folder</param>
/// <param name="ca">The ChangeAction</param>
/// <param name="file">True if file, False if Folder</param>
public static void Show(string name, ChangeAction ca, bool file)
{
if (!Settings.settingsGeneral.Notifications) return;
name = Common._name(name);
string body = string.Format(Get_Message(ca, file), name);
NotificationReady(null, new NotificationArgs { Text = body });
}
示例10: ChangesetPath
public ChangesetPath(ChangeAction action, string path)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentOutOfRangeException("path", path, "Path cannot be null or empty.");
}
_action = action;
_path = path.Trim();
}
示例11: OnValidate
partial void OnValidate(ChangeAction action)
{
using (CmsDataContext dc = new CmsDataContext())
{
if (this.ManufaturerId == null)
this.ManufaturerId = dc.DiscBrands.SingleOrDefault(m => m.Name == this.Manufacturer).Id;
if (this.ManufaturerId != null)
this.Manufacturer = dc.DiscBrands.SingleOrDefault(m => m.Id == this.ManufaturerId).Name;
}
}
示例12: OnValidate
partial void OnValidate(ChangeAction action)
{
if (action == ChangeAction.Insert)
{
using (var dc = new TecdocStoreDataContext())
{
if (dc.NameCorrections.SingleOrDefault(
m => m.OriginalName == OriginalName) != null)
throw new ValidationException("это значение уже есть в списке");
}
}
}
示例13: Validate
/// <summary>
/// Validates this instance.
/// </summary>
/// <param name="dao">The DAO for additional data validation.</param>
/// <param name="changeAction">The change action.</param>
internal override void Validate(GenericDao dao, ChangeAction changeAction)
{
// Perform custom validation
if (changeAction == ChangeAction.Update)
{
this.ValidateGreaterThanZero(() => this.ReportGenerationBatchId);
}
if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
{
}
}
示例14: Validate
/// <summary>
/// Validates this instance.
/// </summary>
/// <param name="dao">The DAO for additional data validation.</param>
/// <param name="changeAction">The change action.</param>
internal override void Validate(GenericDao dao, ChangeAction changeAction)
{
// Perform custom validation
if (changeAction == ChangeAction.Insert || changeAction == ChangeAction.Update)
{
Regex currencyRegex = new Regex("^[A-Z]{3}$");
if (!currencyRegex.IsMatch(this.CurrencyCode))
{
this.Errors.Add("The currency code is invalid");
}
}
}
示例15: OnValidate
partial void OnValidate(ChangeAction action)
{
if (action == ChangeAction.Insert)
{
using (CmsDataContext dc = new CmsDataContext())
{
if (dc.Brands.SingleOrDefault(
m => m.Name == Name && m.VehicleType == VehicleType ) != null )
throw new ValidationException("марка с названием '" +
Name +
"' уже существует");
}
}
}