protected override async Task OnRefreshAsync(CancellationToken ct) { try { this.ShowBusyStatus(Strings.Resources.TextLoading, true); this.RecommendedItemsTask = new NotifyTaskCompletion <IEnumerable <ContentItemBase> >(DataSource.Current.GetRecommendedItemsAsync(ct)); this.FriendsWatchedItemsTask = new NotifyTaskCompletion <IEnumerable <ContentItemBase> >(DataSource.Current.GetFriendsWatchedItemsAsync(ct)); // Load queue data var list = new QueueCollection(); list.AddRange(await DataSource.Current.GetQueueItemsAsync(Platform.Current.AuthManager.User?.ID, ct)); this.Queue = list; ct.ThrowIfCancellationRequested(); this.ShowBusyStatus("Updating tiles..."); await Platform.Current.Notifications.CreateOrUpdateTileAsync(this); this.ClearStatus(); } catch (OperationCanceledException) { this.ShowTimedStatus(Strings.Resources.TextCancellationRequested, 3000); } catch (Exception ex) { this.ShowTimedStatus(Strings.Resources.TextErrorGeneric); Platform.Current.Logger.LogError(ex, "Error during RefreshAsync"); } }
public void ctor_3() { var collection = new QueueCollection <int>(3); Assert.AreEqual(0, collection.Count); Assert.AreEqual(3, collection.MaxCount); Assert.AreEqual(false, collection.IsFull); collection.Add(123); collection.Add(234); Assert.AreEqual(2, collection.Count); Assert.AreEqual(3, collection.MaxCount); Assert.AreEqual(false, collection.IsFull); Assert.AreEqual(234, collection.LastItem); collection.Add(345); Assert.AreEqual(3, collection.Count); Assert.AreEqual(3, collection.MaxCount); Assert.AreEqual(true, collection.IsFull); Assert.AreEqual(345, collection.LastItem); collection.Add(456); Assert.AreEqual(3, collection.Count); Assert.AreEqual(3, collection.MaxCount); Assert.AreEqual(true, collection.IsFull); Assert.AreEqual(456, collection.LastItem); }
/// <summary> /// Read and remove items from queue. /// </summary> /// <returns></returns> public QueueCollection <TValue> DeQueue() { this._init(); QueueCollection <TValue> items = new QueueCollection <TValue>(this, true); return(items); }
/// <summary> /// Default Constructor /// </summary> /// <param name="path">The path where the cache file will be stored, can be change at anytime</param> /// <param name="queue">The queue collection to be written to be cache files</param> /// <param name="cacheFormat">The format to write the cache in</param> public CacheWriter(string path, QueueCollection queue, CacheFormat cacheFormat) { // Set queue collection mQueue = queue; // Set the cache format mCacheFormat = cacheFormat; }
public CacheManager(string path, CacheFormat cacheFormat, int queueCapacity) { // Set preferred directory path mDirectoryPath = path; // Set preferred cache format mCacheFormat = cacheFormat; mQueueCollection = new QueueCollection(queueCapacity); }
public static void Main(string[] args) { DictionaryCollection dictionaryCollection = new DictionaryCollection(); ListCollection listCollection = new ListCollection(); QueueCollection queueCollection = new QueueCollection(); SortedListCollection sortedListCollection = new SortedListCollection(); StackCollection stackCollection = new StackCollection(); dictionaryCollection.FillCollection("dictionary"); listCollection.FillCollection(); queueCollection.FillCollection(); sortedListCollection.FillCollection("sorted list"); stackCollection.FillCollection(); Console.WriteLine(); dictionaryCollection.FindValueByKey(6, "dictionary"); listCollection.FindValueByPosition(600); queueCollection.FindFirstElement(); sortedListCollection.FindValueByKey(300, "sorted list"); stackCollection.FindTopElement(); Console.WriteLine(); dictionaryCollection.RemoveElementByKey(100, "dictionary"); listCollection.RemoveElementByPosition(250); queueCollection.RemoveBeginningElement(); sortedListCollection.RemoveElementByKey(1000, "sorted list"); stackCollection.RemoveTopElement(); Console.WriteLine(); /*List<Vegetable> springSaladIngredients = new List<Vegetable>() * { * new Tomato(200), * new Cucumber(200), * new Onion(50) * }; * Salad springSalad = new Salad (springSaladIngredients, "Spring Salad"); * List<Vegetable> tangySaladIngredients = new List<Vegetable>() * { * new Cucumber(200), * new Avocado(200), * new Lime(50), * new GreenOnion(50) * }; * Salad tangySalad = new Salad(tangySaladIngredients, "Tangy Salad"); * springSalad.getSaladCaloricity(); * tangySalad.getSaladCaloricity(); * springSalad.sortByCalories(); * springSalad.sortByWeigth(); * tangySalad.selectVegetablesByWeigth(40, 150) ; */ }
public void ctor_null() { var collection = new QueueCollection <int>(); Assert.AreEqual(0, collection.Count); Assert.AreEqual(null, collection.MaxCount); Assert.AreEqual(false, collection.IsFull); for (int i = 0; i < 100; i++) { collection.Add(i); } Assert.AreEqual(100, collection.Count); Assert.AreEqual(null, collection.MaxCount); Assert.AreEqual(false, collection.IsFull); }
private QueueContext() { Exchanges = new ExchangeCollection(); Queues = new QueueCollection(); Exchanges.GetOrAdd("xuyan-core-exchange", new Exchange { Name = "xuyan-core-exchange", Type = "direct", Durable = true, AutoDelete = false }); Queues.GetOrAdd("xuyan-core-queue", new Queue { Name = "xuyan-core-queue", Durable = true, Exclusive = false, AutoDelete = false }); }
public amHealths() : base(null) { _practitioners = new PractitionerCollection(this); _patients = new PatientCollection(this); _appointments = new AppointmentCollection(this); _groups = new GroupCollection(this); _members = new MemberCollection(this); _queues = new QueueCollection(this); _messages = new MessageCollection(this); _familys = new FamilyCollection(this); _chronics = new ChronicCollection(this); _allergys = new AllergyCollection(this); _chronicMaps = new ChronicMapCollection(this); _allergyMaps = new AllergyMapCollection(this); }
public void ctor_1() { var collection = new QueueCollection <int>(1); Assert.AreEqual(0, collection.Count); Assert.AreEqual(1, collection.MaxCount); Assert.AreEqual(false, collection.IsFull); collection.Add(123); Assert.AreEqual(1, collection.Count); Assert.AreEqual(1, collection.MaxCount); Assert.AreEqual(true, collection.IsFull); Assert.AreEqual(123, collection.FirstItem); collection.Add(456); Assert.AreEqual(1, collection.Count); Assert.AreEqual(1, collection.MaxCount); Assert.AreEqual(true, collection.IsFull); Assert.AreEqual(456, collection.FirstItem); }
private IEnumerable <IChannel> startListeners(IHandlerPipeline pipeline, BusSettings settings) { _queues = new QueueCollection(_logger, this, pipeline, _cancellation.Token); var senders = settings.KnownSubscribers.Where(x => x.Uri.Scheme == ProtocolName) .ToDictionary(x => x.Uri); foreach (var queue in settings.Loopback) { var receiver = _queues.AddQueue(queue.Name, queue.Parallelization); var uri = $"loopback://{queue.Name}".ToUri(); senders.TryGetValue(uri, out SubscriberAddress subscriber); yield return(new LoopbackChannel(subscriber ?? new SubscriberAddress(uri), receiver)); } foreach (var sender in senders.Values.Where(x => !_queues.Has(x.Uri.QueueName()))) { var receiver = _queues.AddQueue(sender.Uri.QueueName(), 5); yield return(new LoopbackChannel(sender, receiver)); } }
public void CheckQueueCollection() { QueueCollection <int> q = new QueueCollection <int>(); q.Enqueue(1); q.Enqueue(2); q.Enqueue(1); q.Enqueue(3); q.Enqueue(1); var expected = new int[] { 1, 2, 1, 3, 1 }; CollectionAssert.AreEqual(expected, q); q.Dequeue(); expected = new int[] { 2, 1, 3, 1 }; CollectionAssert.AreEqual(expected, q); q.Dequeue(); expected = new int[] { 1, 3, 1 }; CollectionAssert.AreEqual(expected, q); q.Dequeue(); expected = new int[] { 3, 1 }; CollectionAssert.AreEqual(expected, q); Assert.AreEqual(3, q.Peek()); }
protected override async Task OnRefreshAsync(CancellationToken ct) { try { this.ShowBusyStatus(Strings.Resources.TextLoading, true); this.RecommendedItemsTask = new NotifyTaskCompletion<IEnumerable<ContentItemBase>>(DataSource.Current.GetRecommendedItemsAsync(ct)); this.FriendsWatchedItemsTask = new NotifyTaskCompletion<IEnumerable<ContentItemBase>>(DataSource.Current.GetFriendsWatchedItemsAsync(ct)); // Load queue data var list = new QueueCollection(); list.AddRange(await DataSource.Current.GetQueueItemsAsync(Platform.Current.AuthManager.User?.ID, ct)); this.Queue = list; ct.ThrowIfCancellationRequested(); this.ShowBusyStatus("Updating tiles..."); await Platform.Current.Notifications.CreateOrUpdateTileAsync(this); this.ClearStatus(); } catch (OperationCanceledException) { this.ShowTimedStatus(Strings.Resources.TextCancellationRequested, 3000); } catch (Exception ex) { this.ShowTimedStatus(Strings.Resources.TextErrorGeneric); Platform.Current.Logger.LogError(ex, "Error during RefreshAsync"); } }
public static void RegisterQueues(QueueCollection queues) { queues.Add(new AzureStorageQueue("workerrole1", CloudConfigurationManager.GetSetting("StorageConnectionString"))); }
public void WriteQueueToFile(QueueCollection queue, bool overrideCurrent) { // Get file path string filePath = CacheWriterHelper.SetupWrite(DirectoryPath); }
//main() is the entry point for project execuition static void Main(string[] args) { //To keep breakpoint use F9 (key) keyboard //#region <tab> (code segment for region will be automatically created) #region "Understanding ADO.Net" //DataSet Operations LearnADO.TableOperation.RetrieveRecordsDataSet retrieveRecordsDataSet = new LearnADO.TableOperation.RetrieveRecordsDataSet(); DataSet dataSet = retrieveRecordsDataSet.DataSetOperations(); Console.WriteLine(dataSet.GetXml()); //understanding reader object in detail LearnADO.TableOperation.RetrieveRecord retrieveRec = new LearnADO.TableOperation.RetrieveRecord(); retrieveRec.RetrieveRecordSelect(); //get records from table based on search condition string serachProduct = "Monitor 15"; LearnADO.TableOperation.SelectTableRecordProc selectTableRecordProc = new LearnADO.TableOperation.SelectTableRecordProc(); selectTableRecordProc.SearchProduct(serachProduct); //get data from the system table (list all procedures of the database) LearnADO.TableOperation.SelectInformationSchemaProc selectInformationSchemaProc = new LearnADO.TableOperation.SelectInformationSchemaProc(); selectInformationSchemaProc.ListAllStoredProceduresInDatabase(); //copy all data from a table to another table LearnADO.TableOperation.InsertIntoTable insertIntoTable = new LearnADO.TableOperation.InsertIntoTable(); insertIntoTable.CopyTableDataToAnotherTable(); //insert record to table using stored procedure LearnADO.TableOperation.InsertRecordStoredProcedure insertRecordStoredProcedure = new LearnADO.TableOperation.InsertRecordStoredProcedure(); insertRecordStoredProcedure.InsertNewRecordToTable(); //database manupulations string sqlQueryCreateDatabase = "CREATE DATABASE [LEARNDBMP02]"; string sqlQueryRenameDatabase = "ALTER DATABASE LEARNDBMP02 MODIFY NAME = LEARNDBMP04"; string sqlQueryDeleteDatabase = "DROP DATABASE [LEARNDBMP04]"; string message = "Action Completed Successfully"; //table manipulations string sqlQueryCreateTable = @" CREATE TABLE LEARNDBMP01.dbo.Products( ID INT IDENTITY(1, 1) NOT NULL , [Name] NVARCHAR(50) NULL , Price NVARCHAR(50) NULL , [Date] DATETIME NULL CONSTRAINT pk_id PRIMARY KEY(ID) )"; string sqlQueryRenameTable = "Exec sp_rename 'Products', 'Accessories'"; string sqlQueryAddColumn = "ALTER TABLE Accessories ADD Stock NVARCHAR(50)"; string sqlQueryModifyColumn = "ALTER TABLE Accessories ALTER COLUMN Stock INT"; string sqlQueryRemoveColumn = "ALTER TABLE Accessories DROP COLUMN Stock"; string sqlQueryRemoveTable = "DROP TABLE Accessories"; string sqlQueryInsertRecord = "INSERT INTO dbo.Products (NAME, Price, [Date]) VALUES ('LED TV', '$ 120.00', '27-January-2019')"; LearnADO.DatabaseManipulation databaseManipulation = new LearnADO.DatabaseManipulation(); //adding record to table databaseManipulation.DatabaseAction(sqlQueryInsertRecord, message); //table manipulation databaseManipulation.DatabaseAction(sqlQueryRemoveTable, message); databaseManipulation.DatabaseAction(sqlQueryRemoveColumn, message); databaseManipulation.DatabaseAction(sqlQueryModifyColumn, message); databaseManipulation.DatabaseAction(sqlQueryAddColumn, message); databaseManipulation.DatabaseAction(sqlQueryRenameTable, message); databaseManipulation.DatabaseAction(sqlQueryCreateTable, message); //database manupulation databaseManipulation.DatabaseAction(sqlQueryCreateDatabase, message); databaseManipulation.DatabaseAction(sqlQueryRenameDatabase, message); databaseManipulation.DatabaseAction(sqlQueryDeleteDatabase, message); //adding record to table LearnADO.TableOperation.InsertTableRecord insertTableRecord = new LearnADO.TableOperation.InsertTableRecord(); insertTableRecord.InsertNewRecordToTable(); LearnADO.TableOperation.InsertTableRecordParameterized insertTableRecordParameterized = new LearnADO.TableOperation.InsertTableRecordParameterized(); insertTableRecordParameterized.InsertNewRecordToTable(); //table manipulation LearnADO.TableOperation.RenameTable renameTable = new LearnADO.TableOperation.RenameTable(); renameTable.RenameExistingTable(); LearnADO.TableOperation.CreateTable createTable = new LearnADO.TableOperation.CreateTable(); createTable.CreateNewTable(); //... //database manipulation LearnADO.DatabaseOperation.DeleteDatabase deleteDatabase = new LearnADO.DatabaseOperation.DeleteDatabase(); deleteDatabase.RemoveDatabase(); LearnADO.DatabaseOperation.RenameDatabase renameDatabase = new LearnADO.DatabaseOperation.RenameDatabase(); renameDatabase.RenameTheDatabase(); LearnADO.DatabaseOperation.CreateDatabase createDatabase = new LearnADO.DatabaseOperation.CreateDatabase(); createDatabase.CreateNewDatabase(); //table reading LearnADO.TableOperation.RetrieveRecord retrieveRecord = new LearnADO.TableOperation.RetrieveRecord(); retrieveRecord.RetrieveRecordSelect(); #endregion #region "Collections" SortedDictionaryCollection sortedDictionaryCollection = new SortedDictionaryCollection(); sortedDictionaryCollection.GenericSortedDictionary(); HashSetCollection hashSetCollection = new HashSetCollection(); hashSetCollection.StoreElementsToHashSet(); StackCollection stackCollection = new StackCollection(); stackCollection.StackManipulations(); QueueCollection queueCollection = new QueueCollection(); queueCollection.QueueManipulation(); DictionaryCollection dictionaryCollections = new DictionaryCollection(); dictionaryCollections.DictionaryOperations(); SortedListCollection sortedListCollection = new SortedListCollection(); sortedListCollection.SortedList(); ArrayListCollection arrayListCollections = new ArrayListCollection(); arrayListCollections.AddArrayListElement(); ListCollection listCollection = new ListCollection(); Console.ReadLine(); #endregion #region "File Handing in C#" FileIO fileIO = new FileIO(); fileIO.StreamWriterInFiles(); fileIO.StreamReaderInFiles(); fileIO.UnderstandFileDelete(); fileIO.UnderstandFileCopy(); fileIO.UnderstandFileReadAllText(); fileIO.UnderstandFileReadAllLines(); fileIO.UnderstandFileExists(); #endregion #region "Understanding Arrays" Arrays objArrays = new Arrays(); objArrays.MultiDiamentionalArray(); objArrays.AccessingValuesFromArray(); objArrays.AcceptValuesFromUserAndDisplayOutput(); objArrays.ArrayDeclarationAndInitilization(); #endregion #region "StringBuilder and their methods" StringBuilders objStringBuilders = new StringBuilders(); objStringBuilders.StringBuilderFunctions(); #endregion #region "Data types: Value and Reference type" ValueTypeReferenceType objValueTypeReferenceType = new ValueTypeReferenceType(); objValueTypeReferenceType.UnderstandingReferenceType(); //objValueTypeReferenceType.UnderstandingValueType(); #endregion #region "Understanding Loop Statements" LoopStatements objLoopStatements = new LoopStatements(); objLoopStatements.UnderstandingForLoop(); objLoopStatements.UnderstandingForLoopCondStmt(); objLoopStatements.UnderstandingWhileLoop(); objLoopStatements.WhileLoopWithBreakStmt(); objLoopStatements.UnderstandingDoWhileLoop(); objLoopStatements.UnderstandingDoWhileLoopFalseCondition(); objLoopStatements.DoWhileLoopWithBreakStmt(); #endregion #region "Understanding Conditional Statements" //switch statement ConditionalStatements objConditionalStatements = new ConditionalStatements(); objConditionalStatements.SwitchStatement(); objConditionalStatements.GoToInSwitchStatement(); #endregion #region "How to call a Class" //<name of class> <object of the class> <new - allocating memory> <name of the class> //MyClass: is class --> Blue Print --> car //myClass: is object --> Benz, BMW, Audi, Ford, etc.. //MyClass myClass = new MyClass(); MyClass objMyClass = new MyClass(); //Lets set the value to a property and they get the value from the property int valueFromProperty = 0; //Set the value to the property objMyClass.Counter = 4; //Get the value from the property valueFromProperty = objMyClass.Counter; Console.WriteLine(valueFromProperty); objMyClass.PropVariable = 6; //(setter) Console.WriteLine(objMyClass.PropVariable); //(getter) the return value of the private class variable _propVariable //try to see if we are able to access 'Count' and private in scope //objMyClass.Count; (error since its scope is private) //Create an object of newly created class (AnotherClass) //Any new class created will have default methods available AnotherClass objAnotherClass = new AnotherClass(); //objAnotherClass. //Properties with only getter //objMyClass.MarkSheetGrade = "India"; (not possible since it is getter only property) //Properties with only setter objMyClass.CollegeName = "National Engineering College"; //Console.WriteLine(objMyClass.CollegeName); get accessor is not exposed for this propery hence data can not be viewed #endregion #region "Call - Understanding Variables" //Understand C# variables and their declarations UnderstandVariables(); //Understanding C# datatypes in detail UnderstandDataTypes(); #endregion //Purpose of command: to display the output visiable to user until user selects any key in the keyboard Console.ReadKey(); }
public void ctor_0() { var collection = new QueueCollection <int>(0); }
public void Insert() { var collection = new QueueCollection <int>(); collection.Insert(0, 123); }
/// <summary> /// Initializes a new instance of the <see cref="WashController"/> class. /// </summary> /// <param name="queueCollection">The queue collection.</param> /// <param name="configuration">The configuration.</param> /// <param name="operationalStatistics">The operational statistics.</param> public WashController(QueueCollection queueCollection, IConfiguration configuration, OperationalStatistics operationalStatistics) { this.queueCollection = queueCollection; this.configuration = configuration; this.operationalStatistics = operationalStatistics; }
public void Dispose() { mQueueCollection = null; }
private void InitializeQueue() { var assemblies = AppDomain.CurrentDomain.GetAssemblies(); var types = assemblies.SelectMany(a => a.GetTypes()); var taskType = types.SingleOrDefault(t => t.Name == "QueueConfig"); if (taskType == null) { throw new Exception(string.Format("Type for 'QueueConfig' not found")); } var registerMethod = taskType.GetMethod("RegisterQueues"); if (registerMethod == null) { throw new Exception(string.Format("Method 'RegisterQueues' not found on Type 'QueueConfig'")); } var queueCollection = new QueueCollection(); registerMethod.Invoke(null, new object[] { queueCollection }); Queue = queueCollection.Single(); }