public override void WriteTo(string message) { this.buffer.AppendLine(string.Format("{0}{1}", RealTimer.GetCurrentDateTime(), message)); this.printedLinesCounter++; if (this.printedLinesCounter > this.maxBufferedLines) { this.Dispose(); } }
/// <summary> /// Write the message into the log either in text mode or binary mode. /// </summary> /// <param name="message">Message to be written into the log.</param> public override void WriteTo(string message) { if (this.binaryLogEnabled) { this.logBinaryWriter.Write(RealTimer.GetCurrentDateTime() + message); this.logBinaryWriter.Flush(); } else { this.logTextWriter.WriteLine(RealTimer.GetCurrentDateTime() + message); this.logTextWriter.Flush(); } }
void Start() { text = GetComponent <Text>(); blinkTimer = new RealTimer(); }
//====================== START OF FORM EVENTS ========================= /* * Event Handler for Form Load Event * Dynamically adding Categories to the UI * Fetching Product Stock file and building UI components * Fetching textfiles and storing data into the lists */ private void MainForm_Load(object sender, EventArgs e) { RealTimer.Start(); //Making UI changes SearchPanel.Visible = false; InventoryGroupBox.Visible = false; ChangeButtonBorder(1); StreamReader InputFile; string FileLine; //Initializing Lists for Application Use CategoryList = new List <string>(); //Category List ProductList = new List <Product>(); //Main Stock Product List SaleProductIDs = new List <Product>(); //Sold Stock Product List CurrentCartProducts = new List <string>(); //Current Cart List for Enable/Disable purpose ProductIDs = new List <string>(); //Product ID's of all products in the Inventory //Initializing Maximum categories to 50 ProductCategoryList[] NewCatList = new ProductCategoryList[50]; //Reading Category File and fetching Categories InputFile = File.OpenText(CATEGORYDATABASEFILENAME); while (!InputFile.EndOfStream) { FileLine = InputFile.ReadLine(); //Initialzing CategoryList CategoryList.Add(FileLine); //Initialzing ProductCategoryList UserControl NewCatList[1] = new ProductCategoryList { CatName = FileLine }; //Adding Categories to the CategoryFlowLayoutPanel to show various categories CategoryFlowLayoutPanel.Controls.Add(NewCatList[1]); } InputFile.Close(); //if Categories found, fetching products according to categories if (CategoryList.Count > 0) { //Reading Product Stock file InputFile = File.OpenText(PRODUCTDATABASEFILENAME); while (!InputFile.EndOfStream) { //Creating two Sets, //one for Storing Original Stock //One for storing Sold stock in application Run Product p1 = new Product(); Product p2 = new Product(); for (int i = 0; i < RECORDLENGTH; i++) { FileLine = InputFile.ReadLine(); switch (i) { case 0: p1.ProductID = FileLine; p2.ProductID = FileLine; ProductIDs.Add(p1.ProductID); break; case 1: p1.ProductCategory = FileLine; p2.ProductCategory = FileLine; break; case 2: p1.ProductName = FileLine; p2.ProductName = FileLine; break; case 3: p1.ProductPrice = decimal.Parse(FileLine); p2.ProductPrice = decimal.Parse(FileLine); break; case 4: p1.ProductQuantity = int.Parse(FileLine); p2.ProductQuantity = 0; break; } } //Adding products to two seperate lists ProductList.Add(p1); SaleProductIDs.Add(p2); } InputFile.Close(); toolTip1.Show("Select Desired Category to view Products", SaleButton); } else { MessageBox.Show("No Categories found in the Inventory. Try adding Categories first", "No Categories to List", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Write the given message into the console. /// </summary> /// <param name="message"></param> public override void WriteTo(string message) { System.Console.WriteLine(RealTimer.GetCurrentDateTime() + message); }