public ManagerImageReference(CMConfigurationSection config) { TemplateFields = new DispatchedObservableCollection<ManagerTemplateField>(); Config = config; IndexOffset = 0; ImageVariants = new List<ImageVariant>(); }
public ManagerImageReference(CMConfigurationSection config) { TemplateFields = new DispatchedObservableCollection <ManagerTemplateField>(); Config = config; IndexOffset = 0; ImageVariants = new List <ImageVariant>(); }
public PacketBrowserViewModel() : base() { PacketDefinitions = new DispatchedObservableCollection <PacketDefinition>(); PacketDefinitionsView = CollectionViewSource.GetDefaultView(PacketDefinitions); PacketDefinitionsView.Filter = PacketListFilter; }
public WatchThreadSerializer(WatchThreadManager argWatchThreadManager, DownloadManager argDownloadManager, DispatchedObservableCollection<WatchThreadViewItem> argwatchThreadViewCollection) { this.debugLogText = new DebugLog(); this.watchThreadManager = argWatchThreadManager; this.downloadManager = argDownloadManager; this.watchThreadViewCollection = argwatchThreadViewCollection; string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).ToString(), "InBefore404"); try { Directory.CreateDirectory(path); } catch { } this.serializeFilePath = Path.Combine(path, "WatchThreadList.xml"); }
public void RegisterDownloadTaskViewCollection(DispatchedObservableCollection<DownloaderTaskViewItem> argDltaskViewItemList) { this.dltaskViewCollection = argDltaskViewItemList; }
public ManagerCart(string name) { Name = name; Slides = new DispatchedObservableCollection <ManagerImageReference>(); }
public void RegisterWatchThreadViewCollection(DispatchedObservableCollection<WatchThreadViewItem> argwatchThreadViewCollection) { this.watchThreadViewCollection = argwatchThreadViewCollection; }
public ManagerCart(string name) { Name = name; Slides = new DispatchedObservableCollection<ManagerImageReference>(); }
/// <summary> /// Read the templates variables /// </summary> /// <returns>Returns true if changes happened</returns> private bool ReadTemplateFields() { if (Template == null || TemplateFields == null) { return false; } if (!File.Exists(Template) && File.Exists(Path.Combine(Config.SlidesConfiguration.TemplatePath, Template))) { Template = Path.Combine(Config.SlidesConfiguration.TemplatePath, Template); } else if (!File.Exists(Template) && File.Exists(Path.Combine(Config.SlidesConfiguration.TemplatePath, Path.GetFileName(Template)))) { Template = Path.Combine(Config.SlidesConfiguration.TemplatePath, Path.GetFileName(Template)); } else if (!File.Exists(Template)) { return false; } var templateHtml = File.ReadAllText(Template); // Replace @@values@@ with context Values const string pattern = "@@(.*?)@@"; var changes = false; if (TemplateFields == null) TemplateFields = new DispatchedObservableCollection<ManagerTemplateField>(); foreach (Match m in Regex.Matches(templateHtml, pattern)) { var variable = m.Groups[1].Value; string replaceValue = null; if (Context != null && Context.HasValue(variable)) { replaceValue = Context.GetValue(variable); } // Add all fields to template fields if (TemplateFields.Any(x => x.Title == variable)) { // If already in there check if value changed var existing = TemplateFields.First(x => x.Title == variable); if (String.Compare(existing.Value, replaceValue, StringComparison.Ordinal) != 0) { // Update value if (replaceValue != null) { existing.Value = replaceValue; changes = true; } } } else { // Only add once to list TemplateFields.Add(new ManagerTemplateField(variable, replaceValue)); changes = true; } } return changes; }
public ManagerContext() { _config = (CMConfigurationSection)ConfigurationManager.GetSection("CMConfiguration"); Carts = new DispatchedObservableCollection<ManagerCart>(); CartItemsView = CollectionViewSource.GetDefaultView(Carts); CartItemsView.Filter = CartDislpayFilter; DataBase = new DispatchedObservableCollection<DataMessage>(); //RunningEvents = new DispatchedObservableCollection<EventFlow>(); DataFlowItems = new DispatchedObservableCollection<DataFlowItem>(); ImageFlowItems = new DispatchedObservableCollection<DataFlowItem>(); DataFlowItemsView = CollectionViewSource.GetDefaultView(DataFlowItems); DataFlowItemsView.Filter = DataFlowNameFilter; var sortData = new SortDescription { Direction = ListSortDirection.Descending, PropertyName = "Timestamp" }; DataFlowItemsView.SortDescriptions.Add(sortData); ImageFlowItemsView = CollectionViewSource.GetDefaultView(ImageFlowItems); ImageFlowItemsView.Filter = ImageFlowNameFilter; var sortImage = new SortDescription { Direction = ListSortDirection.Descending, PropertyName = "Timestamp" }; ImageFlowItemsView.SortDescriptions.Add(sortImage); #region INPUTS // Open Connection to INBOUND MQ foreach (InputConfiguration input in _config.InputConfigurations) { switch (input.Type.ToUpper()) { case "MQ": { var amquri = input.MQUri; var amqinexchange = input.MQExchange; var dataInConnection = new AMQConsumer(amquri, amqinexchange, this); dataInConnection.Connect(); // TODO Catch hand handle connection exceptions and reconnect _disposables.Add(dataInConnection); } break; case "HTTP": { var httpBindIp = input.BindIp; var httpBindPort = input.BindPort; var dataInHttpServer = new CMHttpServer(httpBindIp, httpBindPort, this); dataInHttpServer.Start(); _disposables.Add(dataInHttpServer); } break; // TODO Handle and log default } } #endregion INPUTS #region OUTPUTS // Open Connection to OUTBOUND MQ if (_config.OutputConfiguration.EnableDataDispatchMQ) { var amquri = _config.OutputConfiguration.DispatchMQConfiguration.MQUri; var amqoutexchange = _config.OutputConfiguration.DispatchMQConfiguration.MQExchange; var dataOutConnection = new AMQQueuePublisher(amquri, amqoutexchange); dataOutConnection.Connect(); _publishers.Add(dataOutConnection); // TODO Catch hand handle connection exceptions and reconnect _disposables.Add(dataOutConnection); } #endregion OUTPUTS if (!ResetFomrFile()) { LoadCarts(true, false); LoadInitialImages(); LoadReceivedImages(); } }
/// <summary> /// Read the templates variables /// </summary> /// <returns>Returns true if changes happened</returns> private bool ReadTemplateFields() { if (Template == null || TemplateFields == null) { return(false); } if (!File.Exists(Template) && File.Exists(Path.Combine(Config.SlidesConfiguration.TemplatePath, Template))) { Template = Path.Combine(Config.SlidesConfiguration.TemplatePath, Template); } else if (!File.Exists(Template) && File.Exists(Path.Combine(Config.SlidesConfiguration.TemplatePath, Path.GetFileName(Template)))) { Template = Path.Combine(Config.SlidesConfiguration.TemplatePath, Path.GetFileName(Template)); } else if (!File.Exists(Template)) { return(false); } var templateHtml = File.ReadAllText(Template); // Pattern used to replace template variables string pattern = "@@(?<variable>.*?)(=(?<default>.*))?@@"; var changes = false; if (TemplateFields == null) { TemplateFields = new DispatchedObservableCollection <ManagerTemplateField>(); } var matches = Regex.Matches(templateHtml, pattern); foreach (Match m in matches) { var variable = m.Groups["variable"].Value; var defaultvalue = m.Groups["default"].Value; var isDefaultValue = false; string replaceValue = null; if (Context != null && Context.HasValue(variable)) { replaceValue = Context.GetValue(variable); } else if (!string.IsNullOrEmpty(defaultvalue)) { replaceValue = defaultvalue; isDefaultValue = true; //// Add to context if any //if (Context != null) //{ // Context.Data.Add(new DataMessage() // {je // Data = null, // DataType = "string", // Key = variable, // Value = defaultvalue // }); //} } // Add all fields to template fields if (TemplateFields.Any(x => x.Title == variable)) { // If already in there check if value changed var existing = TemplateFields.First(x => x.Title == variable); if (!isDefaultValue && String.Compare(existing.Value, replaceValue, StringComparison.Ordinal) != 0) { // Update value if (replaceValue != null) { existing.Value = replaceValue; changes = true; } } } else { // Only add once to list TemplateFields.Add(new ManagerTemplateField(variable, replaceValue)); changes = true; } } return(changes); }
/// <summary> /// Read the templates variables /// </summary> /// <returns>Returns true if changes happened</returns> private bool ReadTemplateFields() { if (Template == null || TemplateFields == null) { return(false); } if (!File.Exists(Template) && File.Exists(Path.Combine(Config.SlidesConfiguration.TemplatePath, Template))) { Template = Path.Combine(Config.SlidesConfiguration.TemplatePath, Template); } else if (!File.Exists(Template) && File.Exists(Path.Combine(Config.SlidesConfiguration.TemplatePath, Path.GetFileName(Template)))) { Template = Path.Combine(Config.SlidesConfiguration.TemplatePath, Path.GetFileName(Template)); } else if (!File.Exists(Template)) { return(false); } var templateHtml = File.ReadAllText(Template); // Replace @@values@@ with context Values const string pattern = "@@(.*?)@@"; var changes = false; if (TemplateFields == null) { TemplateFields = new DispatchedObservableCollection <ManagerTemplateField>(); } foreach (Match m in Regex.Matches(templateHtml, pattern)) { var variable = m.Groups[1].Value; string replaceValue = null; if (Context != null && Context.HasValue(variable)) { replaceValue = Context.GetValue(variable); } // Add all fields to template fields if (TemplateFields.Any(x => x.Title == variable)) { // If already in there check if value changed var existing = TemplateFields.First(x => x.Title == variable); if (String.Compare(existing.Value, replaceValue, StringComparison.Ordinal) != 0) { // Update value if (replaceValue != null) { existing.Value = replaceValue; changes = true; } } } else { // Only add once to list TemplateFields.Add(new ManagerTemplateField(variable, replaceValue)); changes = true; } } return(changes); }
public DownloaderTaskViewItemList(Dispatcher dispatcher) { this.dispatcherUIThread = dispatcher; this.thedltvitems = new DispatchedObservableCollection<DownloaderTaskViewItem>(); }