static void Main(string[] args) { ConsoleSeparator consoleSeparator = new ConsoleSeparator('_', 50); SeparateEvent separateEvent = new SeparateEvent(); separateEvent.OnSeparate += consoleSeparator.Separator; ArrayList list = new ArrayList(); list.Add(2.3); list.Add(55); list.AddRange(new string[] { "Hello", "Hell" }); foreach (object o in list) { Console.WriteLine(o); } list.SetSeparate(separateEvent); list.RemoveAt(0); list.Reverse(); Console.WriteLine(list); list.SetSeparate(separateEvent); for (int i = 0; i < list.Count; i++) { Console.WriteLine(list[i]); } Console.ReadKey(); }
public override Console GetConsole(ConsoleEventHandler.PageEvent pageEvent) { _console = new Console { Items = new List <IConsoleItem>(), Title = "Manage Set" }; _submitButton = new ConsoleButton { Name = Constant.Names.Console.SUBMIT, DisplayText = "Submit", ToolTip = "Click here to submit this Extractor Set to the queue.", RaisesPostBack = true }; _cancelButton = new ConsoleButton { Name = Constant.Names.Console.CANCEL, DisplayText = "Cancel", ToolTip = "Click here to cancel this Extractor Set.", RaisesPostBack = true }; _separator = new ConsoleSeparator(); if (pageEvent == PageEvent.PreRender) { var textExtractorStatus = ActiveArtifact.Fields[Constant.Guids.Fields.ExtractorSet.Status.ToString()].Value.Value; if (textExtractorStatus == null) { _submitButton.Enabled = true; _cancelButton.Enabled = false; } else if (textExtractorStatus.ToString() == Constant.ExtractorSetStatus.CANCELLED || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.COMPLETE || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.COMPLETE_WITH_ERRORS || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.ERROR) { _submitButton.Enabled = false; _cancelButton.Enabled = false; } else { _submitButton.Enabled = false; _cancelButton.Enabled = true; } } _console.Items.Add(_submitButton); _console.Items.Add(_cancelButton); _console.Items.Add(_separator); _console.AddRefreshLinkToConsole().Enabled = true; return(_console); }
static void Main(string[] args) { ConsoleSeparator consoleSeparator = new ConsoleSeparator('_', 50); SeparateEvent separateEvent = new SeparateEvent(); separateEvent.OnSeparate += consoleSeparator.Separator; Queue <int> numbers = new Queue <int>(); numbers.Enqueue(3); numbers.Enqueue(5); numbers.Enqueue(8); var queueElement = numbers.Dequeue(); Console.WriteLine(queueElement); separateEvent.Display(); Queue <Person> person = new Queue <Person>(); person.Enqueue(new Person() { Name = "Tom" }); person.Enqueue(new Person() { Name = "Bill" }); person.Enqueue(new Person() { Name = "John" }); var p = person.Peek(); Console.WriteLine(p.Name); separateEvent.Display(); foreach (Person x in person) { Console.WriteLine(x.Name); } separateEvent.Display(); p = person.Dequeue(); Console.WriteLine(p.Name); separateEvent.Display(); foreach (Person x in person) { Console.WriteLine(x.Name); } Console.ReadKey(); }
static void Main(string[] args) { ConsoleSeparator consoleSeparator = new ConsoleSeparator('-', 50); SeparateEvent separateEvent = new SeparateEvent(); separateEvent.OnSeparate += consoleSeparator.Separator; Stack <int> numbers = new Stack <int>(); numbers.Push(3); numbers.Push(5); numbers.Push(8); foreach (int p in numbers) { Console.WriteLine(p); } separateEvent.Display(); var stackElement = numbers.Pop(); Console.WriteLine(stackElement); separateEvent.Display(); Stack <Person> people = new Stack <Person>(); people.Push(new Person() { Name = "Tom" }); people.Push(new Person() { Name = "Bill" }); people.Push(new Person() { Name = "John" }); foreach (Person p in people) { Console.WriteLine(p.Name); } separateEvent.Display(); var person = people.Pop(); foreach (Person p in people) { Console.WriteLine(p.Name); } Console.ReadKey(); }
static void Main(string[] args) { ConsoleSeparator consoleSeparator = new ConsoleSeparator('-', 50); SeparateEvent separateEvent = new SeparateEvent(); separateEvent.OnSeparate += consoleSeparator.Separator; int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; var factorials = from n in numbers.AsParallel().AsOrdered() select Factorial(n); separateEvent.Display(); foreach (var x in factorials) { Console.WriteLine(x); } }
static void Main(string[] args) { ConsoleSeparator consoleSeparator = new ConsoleSeparator('-', 50); SeparateEvent separateEvent = new SeparateEvent(); separateEvent.OnSeparate += consoleSeparator.Separator; LinkedList <int> numbers = new LinkedList <int>(); numbers.AddLast(1); numbers.AddFirst(2); numbers.AddAfter(numbers.Last, 3); foreach (int x in numbers) { Console.WriteLine(x); } separateEvent.Display(); LinkedList <Person> people = new LinkedList <Person>(); LinkedListNode <Person> linkedListNode = people.AddLast(new Person() { Name = "Tom" }); people.AddLast(new Person() { Name = "John" }); people.AddFirst(new Person() { Name = "Bill" }); foreach (Person person in people) { Console.WriteLine(person.Name); } separateEvent.Display(); Console.WriteLine(linkedListNode.Previous.Value.Name); Console.WriteLine(linkedListNode.Next.Value.Name); Console.ReadKey(); }
static void Main(string[] args) { ConsoleSeparator consoleSeparator = new ConsoleSeparator('-', 50); SeparateEvent separateEvent = new SeparateEvent(); separateEvent.OnSeparate += consoleSeparator.Separator; List <int> numbers = new List <int>() { 1, 2, 3, 45 }; numbers.Add(6); numbers.AddRange(new int[] { 7, 8, 9 }); numbers.Insert(0, 666); numbers.RemoveAt(1); foreach (int x in numbers) { Console.WriteLine(x); } separateEvent.Display(); List <Person> peoples = new List <Person>(); peoples.Add(new Person() { Name = "Tom" }); peoples.Add(new Person() { Name = "Bill" }); foreach (Person person in peoples) { Console.WriteLine(person); } separateEvent.Display(); Console.ReadKey(); }
public override kCura.EventHandler.Console GetConsole(PageEvent pageEvent) { int activeWorkspaceId = this.Helper.GetActiveCaseID(); //Construct a console object to build the console appearing in the UI. kCura.EventHandler.Console returnConsole = new kCura.EventHandler.Console(); returnConsole.Items = new List <IConsoleItem>(); returnConsole.Title = CONSOLE_TITLE; string select = "<h3 style='color:#11599E'>Comments Tree</h3>"; List <string> elements = new List <string>(); elements.Add(select); using (kCura.Relativity.Client.IRSAPIClient client = this.Helper.GetServicesManager().CreateProxy <kCura.Relativity.Client.IRSAPIClient>(Relativity.API.ExecutionIdentity.System)) { client.APIOptions.WorkspaceID = this.Helper.GetActiveCaseID(); Service.SqlService.CommentSqlService commentService = new Service.SqlService.CommentSqlService(this.Helper.GetDBContext(this.Helper.GetActiveCaseID())); Service.RSAPIService.CommentRSAPIService commentRSAPIService = new Service.RSAPIService.CommentRSAPIService(client); Data.Entities.Comment comment = commentRSAPIService.Get(this.ActiveArtifact.ArtifactID); comment.CommentChilds = commentService.GetCommentsChild(comment.ArtifactId); drawCommentTree2(ref elements, (comment.CommentChilds).ToList()); returnConsole.HTMLBlocks = elements; } ConsoleHeader header = new ConsoleHeader("Console Application"); //Construct the submit job button. ConsoleButton submitJobButton = new ConsoleButton(); submitJobButton.Name = INSERT_JOB_BUTTON_NAME; submitJobButton.DisplayText = INSERT_JOB_DISPLAY_TEXT; submitJobButton.ToolTip = INSERT_JOB_TOOL_TIP; submitJobButton.RaisesPostBack = true; submitJobButton.Enabled = true; //Construct the delete job button ConsoleButton deleteJobButton = new ConsoleButton() { Name = DELETE_JOB_BUTTON_NAME, DisplayText = DELETE_JOB_DISPLAY_TEXT, ToolTip = DELETE_JOB_TOOL_TIP, RaisesPostBack = true, Enabled = true }; //Button to see the comment data ConsoleButton seeCommentButton = new ConsoleButton() { Name = "See Comment Data", DisplayText = "Commen Data", ToolTip = "Comment Data", RaisesPostBack = true, Enabled = true }; ConsoleSeparator separador = new ConsoleSeparator(); //If a job is already in the queue, change the text and disable the button. if (pageEvent == PageEvent.PreRender) { SqlParameter commentArtifactId = new SqlParameter("@commentArtifacId", System.Data.SqlDbType.Int); commentArtifactId.Value = ActiveArtifact.ArtifactID; int jobCount = this.Helper.GetDBContext(activeWorkspaceId).ExecuteSqlStatementAsScalar <Int32>(JOB_EXISTS_QUERY, new SqlParameter[] { commentArtifactId }); //Use the helper function to check if a job currently exists. Set Enabled to the opposite value. if (jobCount > 0) { submitJobButton.Enabled = false; deleteJobButton.Enabled = true; } else { submitJobButton.Enabled = true; deleteJobButton.Enabled = false; } //Get the base path to the application. String basePath = this.Application.ApplicationUrl.Substring(0, this.Application.ApplicationUrl.IndexOf("/Case/Mask/")); //Construct the path to the custom page with the current patient artifact id and current workspace. String patientProfilePageUrl = String.Format("{0}/CustomPages/{1}/Home/Index/?artifacId={2}", basePath, COMMENT_HISTORY_APPLICATION_GUID, ActiveArtifact.ArtifactID); //Create the JavaScript for the button and set the button property. String windowOpenJavaScript = String.Format("window.open('{0}', '', 'location=no,scrollbars=yes,menubar=no,toolbar=no,status=no,resizable=yes,width=300,height=400');", patientProfilePageUrl); seeCommentButton.OnClickEvent = windowOpenJavaScript; } //Add the buttons to the console. returnConsole.Items.Add(header); returnConsole.Items.Add(submitJobButton); returnConsole.Items.Add(deleteJobButton); returnConsole.Items.Add(seeCommentButton); returnConsole.Items.Add(separador); return(returnConsole); }