Esempio n. 1
0
        public Task <ITriggerData> BindAsync(object value, ValueBindingContext context)
        {
            FileSystemEventArgs fileEvent = value as FileSystemEventArgs;

            if (fileEvent == null)
            {
                string filePath = value as string;
                fileEvent = GetFileArgsFromString(filePath);
            }

            IValueBinder valueBinder = new FileValueBinder(_parameter, fileEvent);
            IReadOnlyDictionary <string, object> bindingData = GetBindingData(fileEvent);

            return(Task.FromResult <ITriggerData>(new TriggerData(valueBinder, bindingData)));
        }
        public Task<ITriggerData> BindAsync(object value, ValueBindingContext context)
        {
            FileSystemEventArgs fileEvent = value as FileSystemEventArgs;
            if (fileEvent == null)
            {
                string filePath = value as string;
                if (!string.IsNullOrEmpty(filePath))
                {
                    // TODO: This only supports Created events. For Dashboard invocation, how can we
                    // handle Change events?
                    string directory = Path.GetDirectoryName(filePath);
                    string fileName = Path.GetFileName(filePath);

                    fileEvent = new FileSystemEventArgs(WatcherChangeTypes.Created, directory, fileName);
                }
            }

            IValueBinder valueBinder = new FileValueBinder(_parameter, fileEvent);
            IReadOnlyDictionary<string, object> bindingData = GetBindingData(fileEvent);

            return Task.FromResult<ITriggerData>(new TriggerData(valueBinder, bindingData));
        }
Esempio n. 3
0
        public Task <ITriggerData> BindAsync(object value, ValueBindingContext context)
        {
            FileSystemEventArgs fileEvent = value as FileSystemEventArgs;

            if (fileEvent == null)
            {
                string filePath = value as string;
                if (!string.IsNullOrEmpty(filePath))
                {
                    // TODO: This only supports Created events. For Dashboard invocation, how can we
                    // handle Change events?
                    string directory = Path.GetDirectoryName(filePath);
                    string fileName  = Path.GetFileName(filePath);

                    fileEvent = new FileSystemEventArgs(WatcherChangeTypes.Created, directory, fileName);
                }
            }

            IValueBinder valueBinder = new FileValueBinder(_parameter, fileEvent);
            IReadOnlyDictionary <string, object> bindingData = GetBindingData(fileEvent);

            return(Task.FromResult <ITriggerData>(new TriggerData(valueBinder, bindingData)));
        }