public void NodeGetAvailableThreadsTest() { //Arrange List<ComputationalThread> threads; Node iNode = new Node(new List<string>() { "problem1", "problem2" }, 3); Node bNode = new Node(new List<string>() { "problem1", "problem2" }, 2); Node pNode = new Node(new List<string>() { "problem1", "problem2" }, 2); threads = new List<ComputationalThread>(); threads.Add(new ComputationalThread(ComputationalThreadState.Busy, 1000, 5, 2, "problem1")); threads.Add(new ComputationalThread(ComputationalThreadState.Busy, 200000, 5, 1, "problem1")); bNode.Update(threads); threads = new List<ComputationalThread>(); threads.Add(new ComputationalThread(ComputationalThreadState.Busy, 1000, 5, 2, "problem1")); threads.Add(new ComputationalThread(ComputationalThreadState.Idle, 100, null, null, null)); pNode.Update(threads); //Act long iat = iNode.GetAvailableThreads(); long bat = bNode.GetAvailableThreads(); long pat = pNode.GetAvailableThreads(); //Assert Assert.AreEqual(iNode.ParallelThreads, iNode.Threads.Count); Assert.AreEqual(iNode.Threads[0].State, ComputationalThreadState.Idle); Assert.IsNull(iNode.Threads[0].ProblemType); Assert.AreEqual(iat, 3); Assert.AreEqual(bat, 0); Assert.AreEqual(pat, 1); }
public void InitialLoading(Node init) { Load += delegate { grd.DataSource = init["Grid"]; }; }
public void InitialLoading(Node node) { Load += delegate { grd.DataSource = node["Grid"]; }; }
protected void flickr_Click(object sender, EventArgs e) { Node node = new Node(); node["ActiveFolder"].Value = tree.SelectedNodes[0].Xtra; ActiveEvents.Instance.RaiseActiveEvent( this, "RequestFlickrResourceDownloadDialog", node); }
protected void grid_Action(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["Username"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "InitiateNewChat", node); }
protected void grd_Action(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["AppName"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "InstalledApps-ViewDetailsOfApp", node); }
protected void grid_RowDeleted(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["ID"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "DeleteADGroup2RoleMappin", node); }
protected void grid_Action(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["ID"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "OpenHistoryItem", node); }
protected void grid_Action(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["UserID"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "EditUser", node); }
protected void txtPageSize_TextChanged(object sender, EventArgs e) { Node node = new Node(); node["WhiteboardID"].Value = WhiteboardID; node["PageSize"].Value = ((InPlaceEdit)sender).Text; ActiveEvents.Instance.RaiseActiveEvent( this, "UpdateWhiteboard", node); }
protected void grid_CellEdited(object sender, Grid.GridEditEventArgs e) { Node node = new Node(); node["ID"].Value = e.ID; node["URL"].Value = e.NewValue.ToString(); ActiveEvents.Instance.RaiseActiveEvent( this, "EditRSSItemURL", node); }
protected void grid_CellEdited(object sender, Grid.GridEditEventArgs e) { Node node = new Node(); node["ID"].Value = e.ID; node[e.Key].Value = e.NewValue; ActiveEvents.Instance.RaiseActiveEvent( this, "ChangeADGroupToRoleMapping", node); }
protected void enableFiltering_CheckedChanged(object sender, EventArgs e) { Node node = new Node(); node["WhiteboardID"].Value = WhiteboardID; node["EnableFiltering"].Value = ((CheckBox)sender).Checked; ActiveEvents.Instance.RaiseActiveEvent( this, "UpdateWhiteboard", node); }
protected void grid_RowDeleted(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["RowID"].Value = e.ID; node["WhiteboardID"].Value = WhiteboardID; ActiveEvents.Instance.RaiseActiveEvent( this, "DeleteWhiteboardRow", node); }
protected void addColumn_Click(object sender, EventArgs e) { Node node = new Node(); ActiveEvents.Instance.RaiseActiveEvent( this, "AddNewRSSItem", node); grd.DataSource = node["Grid"]; grd.Rebind(); }
protected void grid_Deleted(object sender, Grid.GridActionEventArgs e) { Node node = new Node(); node["ID"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "DeleteFavourite", node); }
public void InitialLoading(Node node) { grd.DataSource = node["Grid"]; Load += delegate { DeleteEventName = node["DeleteEventName"].Get<string>(); EditEventName = node["EditEventName"].Get<string>(); }; }
protected void grid_CellEdited(object sender, Grid.GridEditEventArgs e) { Node node = new Node(); node["WhiteboardID"].Value = WhiteboardID; node["RowID"].Value = e.ID; node["ColumnName"].Value = e.Key; node["Value"].Value = e.NewValue; ActiveEvents.Instance.RaiseActiveEvent( this, "WhiteboardRowValueEdited", node); }
protected void addRow_Click(object sender, EventArgs e) { Node node = new Node(); node["WhiteboardID"].Value = WhiteboardID; ActiveEvents.Instance.RaiseActiveEvent( this, "AddRowToWhiteboard", node); grd.DataSource = node["Whiteboard"]; grd.PageToEnd(); grd.Rebind(); }
protected void addFavourites_Click(object sender, EventArgs e) { Node init = new Node(); ActiveEvents.Instance.RaiseActiveEvent( this, "AddFavourite", init); if (init["Failure"].Value == null) { grd.DataSource = init["Grid"]; grd.Rebind(); } }
public void InitialLoading(Node node) { Load += delegate { grd.EnableHeaders = node["Whiteboard"]["EnableHeaders"].Get<bool>(); grd.EnableFilter = node["Whiteboard"]["EnableFiltering"].Get<bool>(); grd.PageSize = node["Whiteboard"]["PageSize"].Get<int>(); grd.EnableDeletion = node["Whiteboard"]["EnableDeletion"].Get<bool>(); grd.DataSource = node["Whiteboard"]; WhiteboardID = node["Whiteboard"]["ID"].Get<string>(); }; }
protected void btnSearch_Click(object sender, EventArgs e) { string query = search.Text; Node node = new Node(); node["Query"].Value = query; ActiveEvents.Instance.RaiseActiveEvent( this, "SearchFlickrForImages", node); rep.DataSource = node["Images"]; rep.DataBind(); pnlRepWrp.ReRender(); OldPreviewImageID = null; }
public void InitialLoading(Node node) { header.Text = node["Whiteboard"]["Name"].Get<string>(); Load += delegate { WhiteboardID = node["Whiteboard"]["ID"].Get<string>(); DataBindGrid(node); enableFiltering.Checked = node["Whiteboard"]["EnableFiltering"].Get<bool>(); txtPageSize.Text = node["Whiteboard"]["PageSize"].Get<int>().ToString(); chkEnableHeader.Checked = node["Whiteboard"]["EnableHeaders"].Get<bool>(); chkEnableDeletion.Checked = node["Whiteboard"]["EnableDeletion"].Get<bool>(); }; }
protected void WhiteBoardDeleted(object sender, ActiveEventArgs e) { Node node = new Node(); node["ID"].Value = e.Params["WhiteboardID"].Get<string>(); ActiveEvents.Instance.RaiseActiveEvent( this, "DeleteWhiteboard", node); // Just forwarding to our menu event ... // To make sure this control is RE-loaded...!! ActiveEvents.Instance.RaiseActiveEvent( this, "Menu-ViewAllWhiteboards"); }
protected void grid_RowDeleted(object sender, Grid.GridActionEventArgs e) { Node init = new Node(); init["TabCaption"].Value = Language.Instance["AreYouSure", null, "Are you sure?"]; init["Width"].Value = 350; init["Height"].Value = 130; init["ModuleSettings"]["Text"].Value = Language.Instance["ReallyDeleteWhiteBoard", null, @"Do you really want to delete the selected whiteboard?"]; init["ModuleSettings"]["EventToRaiseOnOK"].Value = "WhiteBoardConfirmedDeleted"; init["ModuleSettings"]["Params"]["Name"].Value = "WhiteboardID"; init["ModuleSettings"]["Params"]["Value"].Value = e.ID; ActiveEvents.Instance.RaiseLoadControl( "CommonModules.MessageBox", "dynPopup", init); }
public void InitialLoading(Node node) { Node tmp = new Node(); tmp["Columns"]["Key"]["Caption"].Value = Language.Instance["LanguageEditKeyCaption", null, "Key"]; tmp["Columns"]["Key"]["ControlType"].Value = "Label"; tmp["Columns"][Language.Instance.UserLanguage]["Caption"].Value = Language.Instance.UserLanguage; tmp["Columns"][Language.Instance.UserLanguage]["ControlType"].Value = "TextAreaEdit"; int idxNo = 0; foreach (string idx in Language.Instance.Keys) { tmp["Rows"]["Row" + idxNo]["ID"].Value = idx; tmp["Rows"]["Row" + idxNo]["Key"].Value = idx; tmp["Rows"]["Row" + idxNo][Language.Instance.UserLanguage].Value = Language.Instance[idx]; idxNo += 1; } grd.DataSource = tmp; }
protected void grid_Action(object sender, Grid.GridActionEventArgs e) { if (e.ColumnName == "View") { Node node = new Node(); node["ID"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "WhiteboardSelectedForViewing", node); } else if (e.ColumnName == "Edit") { Node node = new Node(); node["ID"].Value = e.ID; ActiveEvents.Instance.RaiseActiveEvent( this, "WhiteboardSelectedForEditing", node); } }
public void NodeUpdateTest() { //Arrange Node node = new Node(new List<string>() { "problem1", "problem2" }, 2); node.TemporaryProblems.Add( new TempProblem(5, ProblemStatus.WaitingForPartialSolutions, new List<TempPartial>() { new TempPartial(1, PartialProblemStatus.Sended) })); node.TemporaryProblems.Add( new TempProblem(5, ProblemStatus.WaitingForPartialSolutions, new List<TempPartial>() { new TempPartial(2, PartialProblemStatus.Sended) })); DateTime lastTime = node.LastTime; List<ComputationalThread> threads = new List<ComputationalThread>(); threads.Add(new ComputationalThread(ComputationalThreadState.Idle, 1000, null, null, null)); threads.Add(new ComputationalThread(ComputationalThreadState.Busy, 200000, 5, 1, "problem1")); //Act node.Update(threads); //Assert Assert.IsNotNull(node.Threads); Assert.IsNotNull(node.TemporaryProblems); Assert.AreEqual(node.TemporaryProblems.Count, 1); Assert.AreEqual(node.Threads.Count, 2); Assert.AreEqual<ulong>(node.TemporaryProblems[0].ProblemId, 5); Assert.AreEqual(node.TemporaryProblems[0].Status, ProblemStatus.WaitingForPartialSolutions); Assert.IsNotNull(node.TemporaryProblems[0].PartialProblems); Assert.AreEqual(node.TemporaryProblems[0].PartialProblems.Count, 1); Assert.AreEqual<ulong>(node.TemporaryProblems[0].PartialProblems[0].PartialId, 2); Assert.AreEqual(node.TemporaryProblems[0].PartialProblems[0].PartialStatus, PartialProblemStatus.Sended); Assert.AreEqual(node.Threads.Where(x => x.State == ComputationalThreadState.Busy).Count(), 1); Assert.AreEqual<ulong?>(node.Threads.Where(x => x.State == ComputationalThreadState.Busy).First().TaskId, 1); Assert.AreEqual(node.Threads.Where(x => x.State == ComputationalThreadState.Busy).First().ProblemType, "problem1"); Assert.AreEqual<ulong?>(node.Threads.Where(x => x.State == ComputationalThreadState.Busy).First().ProblemInstanceId, 5); Assert.AreEqual<ulong>(node.Threads.Where(x => x.State == ComputationalThreadState.Busy).First().HowLong, 200000); }
private void DataBindGrid(Node node) { // Creating grid... Node gridNode = new Node("Grid"); gridNode["Columns"]["Name"]["Caption"].Value = Language.Instance["WhiteboardColumnCaption", null, "Column"]; gridNode["Columns"]["Name"]["ControlType"].Value = "InPlaceEdit"; gridNode["Columns"]["Type"]["Caption"].Value = Language.Instance["WhiteboardColumnTypeCaption", null, "ColumnType"]; gridNode["Columns"]["Type"]["ControlType"].Value = "List"; Node colTypes = new Node(); ActiveEvents.Instance.RaiseActiveEvent( null, "GetWhiteboardColumnTypes", colTypes); int idxNo = 0; foreach (Node idx in colTypes["Types"]) { gridNode["Columns"]["Type"]["Values"]["Value" + idxNo].Value = idx.Name; idxNo += 1; } gridNode["Columns"]["Position"]["Caption"].Value = Language.Instance["WhiteboardPositionCaption", null, "Position"]; gridNode["Columns"]["Position"]["ControlType"].Value = "InPlaceEdit"; gridNode["Columns"]["ShowInSummary"]["Caption"].Value = Language.Instance["ShowInSummary", null, "Show in summary"]; gridNode["Columns"]["ShowInSummary"]["ControlType"].Value = "InPlaceEdit"; idxNo = 0; foreach (Node idx in node["Whiteboard"]["Columns"]) { gridNode["Rows"]["Row" + idxNo]["ID"].Value = idx["ID"].Get<string>(); gridNode["Rows"]["Row" + idxNo]["Name"].Value = idx["Caption"].Get<string>(); gridNode["Rows"]["Row" + idxNo]["Type"].Value = idx["Type"].Get<string>(); gridNode["Rows"]["Row" + idxNo]["Position"].Value = idx["Position"].Get<string>(); gridNode["Rows"]["Row" + idxNo]["ShowInSummary"].Value = idx["ShowInSummary"].Value.ToString(); idxNo += 1; } grd.DataSource = gridNode; }
public void InitialLoading(Node node) { Load += delegate { SelectMode = node["Mode"].Value != null ? true : false; EventToRaise = node["EventToRaise"].Get<string>(); }; }