public void Clear() { Queues.Clear(); OnMergeQueueChanged(new MergeQueueEventArgs() { Mode = QueueChangeMode.Clear, }); }
public void SetQueues(IEnumerable <Queue> newQueues) { Queues.Clear(); foreach (var queue in newQueues.Distinct()) { Queues.Add(queue); } }
public void SetQueues(params IQueue[] queues) { if (queues == null) { throw new ArgumentNullException(nameof(queues)); } Queues.Clear(); Queues.AddRange(queues); }
private async Task UpdateFilterResultAsync() { await Parent.ExecuteAsync(() => { using (var ps = Progress.Start(_originalQueueList.Count, LongRunningState.No)) { _filterProgressScope = ps; Queues.Clear(); QueuesFilterView.Refresh(); _filterProgressScope = null; } }); }
/// <summary> /// Cancel the shift without completing all work /// </summary> public void Cancel() { this.IsActive = false; foreach (var w in Workers) { w.Cancel(); } foreach (var q in Queues) { q.Stop(); } Workers.Clear(); Queues.Clear(); }
private void InitCollectionView(List <QueueInfo> queues) { _originalQueueList = queues; HasSystemQueues = queues.Any(q => q.QueueSource.IsSystemQueue); QueuesFilterView = (CollectionView)CollectionViewSource.GetDefaultView(queues); Queues.Clear(); using (_filterProgressScope = Progress.Start(queues.Count, LongRunningState.No)) { using (QueuesFilterView.DeferRefresh()) { QueuesFilterView.Filter = OnQueuesViewFilter; QueuesFilterView.SortDescriptions.Add( new SortDescription("Name", ListSortDirection.Ascending)); } } StatusInfoViewModel.LastUpdateTimestamp = DateTime.Now; }
private async Task InitializeCoreAsync() { await Parent.ExecuteAsync(() => { Queues.Clear(); ((QueueListStatusInfo)StatusInfoViewModel).ConnectionInformation = Qm.ConnectionInfo; var qInfos = new List <QueueInfo>(); Initialized = Parent.ExecuteGuarded(() => { foreach (var q in ObjectProvider.GetQueues()) { qInfos.Add(new QueueInfo(q, Parent.App.UserSettings)); } }); InitCollectionView(qInfos); }); }
[Fact] public void Clear() { Data_Generator dg = new Data_Generator(); Hand_Generator hg = new Hand_Generator(dg); var dat_hnd = hg.newHand(hg.newFingerList()); var dat_fps = dg.newFloat(100); var exp_hnd = dat_hnd; var exp_pos = hg.newJoints(); var mock_jh = new Mock <IJointsHelper>(); mock_jh.Setup(m => m.handToJoints(dat_hnd)).Returns(exp_pos); var org_N_SAMPLES = GBL.N_SAMPLES; GBL.N_SAMPLES = dg.newInt(100); var q = new Queues(mock_jh.Object); q.LoadSample(dat_hnd, dat_fps); q.Clear(); var act_hnd = q.GetSamples(); var act_pos = q.GetPositions(); var act_vel = q.GetVelocities(); GBL.N_SAMPLES = org_N_SAMPLES; (List <Hand> samples, List <Joints> positions, List <Joints> velocities)exp; exp.samples = null; exp.positions = null; exp.velocities = null; test.Equals(act_hnd, exp.samples); test.Equals(act_pos, exp.positions); test.Equals(act_vel, exp.velocities); }
public void Clear() { Queues.Clear(); OnMergeQueueChanged(); }
/// <summary> /// Deserializes the specified <see cref="System.Xml.XmlDocument">XmlDocument</see>. /// </summary> /// <param name="ccnetConfig">The ccnet config.</param> /// <exception cref="CCNetConfig.Core.Exceptions.DuplicateProjectNameException">DuplicateProjectNameException</exception> public void Deserialize(XmlDocument ccnetConfig) { this.Projects.Clear(); Queues.Clear(); Version v = Util.GetConfigFileVersion(ccnetConfig); if (v != null) { this.Version = v; } if (ccnetConfig.DocumentElement != null && string.Compare(ccnetConfig.DocumentElement.Name, "cruisecontrol", false) == 0) { /*this.Entities = ccnetConfig.DocumentType.Entities; * foreach ( XmlEntity entity in this.Entities ) { * Console.WriteLine ( entity.ToString () ); * }*/ ItemSerialiserFactory factory = new ItemSerialiserFactory(); // Attempt to deserialise each item in the configuration foreach (XmlElement item in ccnetConfig.DocumentElement.SelectNodes("*")) { IItemSerialiser serialiser = factory.Retrieve(item.Name); if (serialiser != null) { // The serialiser factory knows the item type, so it can be deserialised and // added to the correct collection object output = serialiser.Deserialize(item); if (output is Project) { Project p = output as Project; if (!this.Projects.Contains(p.Name)) { this.Projects.Add(p); } else { throw new DuplicateProjectNameException(p.Name); } } else if (output is Queue) { Queue q = output as Queue; if (!Queues.Contains(q.Name)) { Queues.Add(q); } else { throw new Exception(string.Format("Duplicate queue definition: '{0}'", q.Name)); } } else if (output is ServerSecurity) { Security = output as ServerSecurity; } } else { // Currently throwing an exception if an unhandled item is found // This should be changed to something a bit nicer throw new Exception( string.Format("Unhandled item found: '{0}'", item.Name)); } } if (Util.UserSettings.SortProject) { this.Projects.Sort(new ProjectList.ProjectComparer()); } // Check all the projects and add any explicit queues that don't have their own configuration foreach (Project p in Projects) { if (!string.IsNullOrEmpty(p.Queue)) { if (!Queues.Contains(p.Queue)) { Queue queue = new Queue(); queue.Name = p.Queue; Queues.Add(queue); } Queues[p.Queue].Projects.Add(p); } } } else { throw new InvalidCastException(string.Format("Can not convert {0} to a cruisecontrol", ccnetConfig.DocumentElement != null ? ccnetConfig.DocumentElement.Name : "UNKNOWN")); } }
async Task <bool> ExecuteLoadQueuesAsync(bool force = false) { if (IsBusy) { return(false); } var realm = App.GetRealm(); try { IsBusy = true; NoQueuesFound = false; var queues = realm.All <RealmCloudQueue>(); if (queues.Count() > 0 && force == false) { //Load from local containers var storageAccounts = realm.All <StorageAccountExt>().Where(sa => sa.IsStorageAccountOn); List <ASECloudQueue> aseQueues = new List <ASECloudQueue>(); if (storageAccounts.Count() > 0) { foreach (var queue in queues) { StorageAccountsExist = true; var storageAccount = storageAccounts.Where((arg) => arg.Name == queue.StorageAccountName).FirstOrDefault(); if (storageAccount != null) { var te = new CloudQueue(new Uri(queue.QueueUri), new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(storageAccount.Name, storageAccount.PrimaryKey)); aseQueues.Add(new ASECloudQueue(te, storageAccount.Name)); } } Queues.Clear(); Queues.AddRange(aseQueues); } } else { var storageAccounts = realm.All <StorageAccountExt>().Where(sa => sa.IsStorageAccountOn); Queues.Clear(); foreach (var account in storageAccounts) { string connectionString = Constants.StorageConnectionString; connectionString = connectionString.Replace("<ACCOUNTNAME>", account.Name); connectionString = connectionString.Replace("<ACCOUNTKEY>", account.PrimaryKey); Console.WriteLine("Connecting with: " + connectionString); CloudStorageAccount sa = CloudStorageAccount.Parse(connectionString); var queueClient = sa.CreateCloudQueueClient(); var fetchedQueues = await queueClient.ListQueuesAsync(); List <ASECloudQueue> aseQueues = new List <ASECloudQueue>(); for (int i = 0; i < fetchedQueues.Count; i++) { aseQueues.Add(new ASECloudQueue(fetchedQueues[i])); } aseQueues.All(c => { c.StorageAccountName = account.Name; return(true); }); Queues.AddRange(aseQueues); } if (storageAccounts.Count() > 0) { StorageAccountsExist = true; } else { StorageAccountsExist = false; } await realm.WriteAsync(temprealm => { temprealm.RemoveAll <RealmCloudQueue>(); foreach (var que in Queues) { temprealm.Add(new RealmCloudQueue(que.QueueName, que.StorageAccountName, que.BaseQueue.Uri.ToString())); } }); realm.All <RealmCloudQueue>().SubscribeForNotifications((sender, changes, error) => { Console.WriteLine("Change to RealmCloudQueues"); }); } SortQueues(); if (Queues.Count == 0) { NoQueuesFound = true; } else { NoQueuesFound = false; } } catch (Exception ex) { Logger.Report(ex, "Method", "ExecuteLoadQueuesAsync"); MessagingService.Current.SendMessage(MessageKeys.Error, ex); } finally { IsBusy = false; } return(true); }