当前位置: 首页>>代码示例>>C#>>正文


C# ChangeAction类代码示例

本文整理汇总了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);
        }
开发者ID:BroneKot,项目名称:FTPbox,代码行数:32,代码来源:FolderWatcher.cs

示例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");
                }
            }
        }
开发者ID:rsdgjb,项目名称:GRP,代码行数:39,代码来源:ReportGenerationQueue.cs

示例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 });
        }
开发者ID:pstagner,项目名称:FTPbox,代码行数:14,代码来源:Notifications.cs

示例4: RaiseComponentsChanged

 protected void RaiseComponentsChanged( ComponentModel componentModel, ChangeAction action )
 {
     var handler = ComponentsChanged;
      if ( handler != null )
      {
     handler( this, new ComponentsChangedEventArgs( componentModel, action ) );
      }
 }
开发者ID:FINESCE,项目名称:ComponentCompositionFramework,代码行数:8,代码来源:ComponentComposerBase.cs

示例5: OnValidate

partial         void OnValidate(ChangeAction action)
        {
            if (!IsValid)
            {
                RuleViolation first = GetRuleViolations().First();
                throw new RuleViolationException(first.ErrorMessage);
            }
        }
开发者ID:robperson,项目名称:AssessTrack,代码行数:8,代码来源:File.cs

示例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);
     }
 }
开发者ID:rsdgjb,项目名称:GRP,代码行数:13,代码来源:ReportParameterActivityType.cs

示例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 });
		}
开发者ID:bakern,项目名称:FTPbox,代码行数:15,代码来源:Notifications.cs

示例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 });
        }
开发者ID:jiangguang5201314,项目名称:FTPbox,代码行数:15,代码来源:Notifications.cs

示例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 });
        }
开发者ID:nelsont,项目名称:FTPbox,代码行数:15,代码来源:Notifications.cs

示例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();
        }
开发者ID:davidsidlinger,项目名称:ccnet-hg-nosuck,代码行数:10,代码来源:ChangesetPath.cs

示例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;
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:10,代码来源:Disc.cs

示例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("это значение уже есть в списке");
                }
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:12,代码来源:NameCorrection.cs

示例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)
            {
            }
        }
开发者ID:rsdgjb,项目名称:GRP,代码行数:17,代码来源:ReportGenerationBatch.cs

示例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");
         }
     }
 }
开发者ID:rsdgjb,项目名称:GRP,代码行数:17,代码来源:ReportParameterCurrency.cs

示例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 +
                            "' уже существует");
                }
            }
        }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:14,代码来源:Brand.cs


注:本文中的ChangeAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。