private void RefreshResult(Result result, string smallImage, string largeImage, string text, string[] subTexts) { // Update the result. int newSmallIndex = AddResultImage(smallImage); int newLargeIndex = AddResultImage(largeImage); result.SmallImageIndex = newSmallIndex; result.LargeImageIndex = newLargeIndex; result.Text = text; result.SubTexts.Reset(subTexts); // Update the image. ResultDataItem rdi = new ResultDataItem(); rdi.ItemId = result.ID; rdi.Mask = (uint)ResultDataItemMask.Image; rdi.Image = -1; IResultData resultData = Snapin.ResultViewConsole as IResultData; resultData.SetItem(ref rdi); // Redraw. resultData.UpdateItem(result.ID); }
public Result(ICaseInfo @case, IProcedure procedure, ISubjectInfo subject, IResultData data) { this.@case = @case; this.procedure = procedure; this.subject = subject; this.data = data; }
private void SetResultImage(Result result, string smallImage, string largeImage) { int newSmallIndex = AddResultImage(smallImage); int newLargeIndex = AddResultImage(largeImage); if (newSmallIndex == result.SmallImageIndex && newLargeIndex == result.LargeImageIndex) { return; // No change. } result.SmallImageIndex = newSmallIndex; result.LargeImageIndex = newLargeIndex; // Update the image. ResultDataItem rdi = new ResultDataItem(); rdi.ItemId = result.ID; rdi.Mask = (uint)ResultDataItemMask.Image; rdi.Image = -1; IResultData resultData = Snapin.ResultViewConsole as IResultData; resultData.SetItem(ref rdi); // Redraw. resultData.UpdateItem(result.ID); }
public SpecialOperationIResultData(OPERATIONTYPE operationType, IResultData firsResultData, IResultData secondResultData) { this.operationType = operationType; this.firsResultData = firsResultData; this.secondResultData = secondResultData; resultDataType = RESULTDATATYPE.SPECIALOPERATION; }
public IResultData ConstructResult <TType>(IEnumerable <TType> collection, IResultData resultObject) { resultObject.Data = collection; resultObject.Total = collection.Count(); return(resultObject); }
private void PrintCaseTableContent(IReportInfo report, ICaseInfo @case, ICollection <IRemark> remarks) { int procedureWidth = 19; int nameWidth = this.width - 2 * procedureWidth; foreach (ISubjectInfo subject in report.GetSubjects()) { IResultData serialization = report.GetSerializationData(subject, @case); IResultData deserialization = report.GetDeserializationData(subject, @case); this.output.Write(subject.Name.PadRight(nameWidth)); this.output.Write(serialization.Describe().PadLeft(procedureWidth)); this.output.Write(deserialization.Describe().PadLeft(procedureWidth)); this.output.WriteLine(); if (serialization.HasRemark()) { remarks.Add(serialization.GetRemark()); } if (deserialization.HasRemark()) { remarks.Add(deserialization.GetRemark()); } } }
/// <summary> /// Default constructor /// </summary> public SWMM5IntFileBridge(IResultData resultData, bool asRR) { _asRR = asRR; if (!(resultData is ResultData)) { throw new ArgumentException("SWMM5InfFileBridge requires a ResultData object"); } _resultData = resultData as ResultData; }
private void SelectResult(Result result) { Debug.Assert(result != null, "result != null"); // Set it to be selected and focused. IResultData resultData = (IResultData)Snapin.ResultViewConsole; resultData.ModifyItemState(0, result.ID, (uint)(ListViewItemState.Focused | ListViewItemState.Selected), 0); }
public bool IsValidComparation(IResultData Idata, IResultData IdataToChekAgainst) { bool isValid = false; ResultData data = Idata.GetResultData(); ResultData dataToChekAgainst = IdataToChekAgainst.GetResultData(); switch (filtter) { case COMPARATIONTYPE.LESS: if (data.amount < dataToChekAgainst.amount) { isValid = true; } break; case COMPARATIONTYPE.LESSOREQUAL: if (data.amount <= dataToChekAgainst.amount) { isValid = true; } break; case COMPARATIONTYPE.EQUEAL: if (data.amount == dataToChekAgainst.amount) { isValid = true; } break; case COMPARATIONTYPE.GREATER: if (data.amount > dataToChekAgainst.amount) { isValid = true; } break; case COMPARATIONTYPE.GREATEROREQUAL: if (data.amount >= dataToChekAgainst.amount) { isValid = true; } break; case COMPARATIONTYPE.DIFFERENT: if (data.amount != dataToChekAgainst.amount) { isValid = true; } break; default: break; } return(isValid); }
private ResultDataItem GetNextResultItem(int index) { ResultDataItem rdi = new ResultDataItem(); rdi.Mask = (uint)ResultDataItemMask.State; rdi.Col = 0; rdi.Index = index; IResultData resultData = Snapin.ResultViewConsole as IResultData; resultData.GetNextItem(ref rdi); return(rdi); }
public PublishResultsTimer(IHubContext <ResultsHub> hubContext, IResultData resultData, IConfiguration configuration) { _hubContext = hubContext; _resultData = resultData; var publishMilliseconds = configuration.GetValue <int>("ResultsTimer:PublishMilliseconds"); _timer = new Timer(publishMilliseconds) { Enabled = false }; _timer.Elapsed += PublishResults; }
public IResultData Process <T>(IResource <T> resource, ISubject subject, ITimes times) where T : class { IResultData result = null; try { result = result ?? Validate <T>(resource, subject); result = result ?? Deserialize <T>(resource, subject, times); } catch (Exception ex) { result = new FailedByExceptionResult(ex); } return(result); }
protected bool IsUseSmallIcons() { IConsole2 console = Snapin.ResultViewConsole; if (console != null) { IResultData resultdata = console as IResultData; if (resultdata != null) { int viewType = 0; resultdata.GetViewMode(out viewType); return(viewType != 0); } } // Default to small icons. return(true); }
internal ResultDataItem GetSelectedItem(IResultData resultData, int index) { ResultDataItem item = new ResultDataItem(); item.Mask = (uint)ResultDataItemFlags.State; item.Col = 0; item.Index = index; item.State = (uint)ListViewItemState.Selected; try { resultData.GetNextItem(ref item); } catch (COMException) { } return(item); }
public void Should_ApplyExpressionSuccessfully() { // Arrange var modulesManager = new Core.ModulesManager(); var comboRequestJson = new ComboRequestJson { Filters = new List <FilterObject> { new FilterObject { Op = "eq", Prop = "Page", Value = 2 } } }; var collection = new List <PaginationObject> { new PaginationObject { Page = 1, PageSize = 10 }, new PaginationObject { Page = 2, PageSize = 10 } }; // Act IResultData resultData = modulesManager.ApplyModulesExpressions(collection, comboRequestJson); // Assert IResultData expected = new ResultData { Data = new List <PaginationObject> { new PaginationObject { Page = 2, PageSize = 10 } } }; int expectedCount = expected.Data.Cast <PaginationObject>().Count(); int actualCount = resultData.Data.Cast <PaginationObject>().Count(); Assert.AreEqual(expectedCount, actualCount); }
protected void AddResult(object data, string name, string text, string[] subTexts) { // Add the item. IResultData resultData = Snapin.ResultViewConsole as IResultData; ResultDataItem rdi = new ResultDataItem(); rdi.Mask = (uint)ResultDataItemMask.Str | (uint)ResultDataItemMask.Image | (uint)ResultDataItemMask.Param; rdi.Image = -1; rdi.Str = (IntPtr)(-1); rdi.Col = 0; int resultParam = m_results.Count; rdi.Param = GetItemParamFromResultParam(resultParam); resultData.InsertItem(ref rdi); // Add the result details. m_results.Add(new Result(rdi.ItemId, -1, -1, data, name, text, subTexts, resultParam)); }
private IResultData Validate <T>(IResource <T> resource, ISubject subject) where T : class { IPayload payload = subject.Create <T>(resource); T template = resource.GetInstance(); ICompareLogic comparer = new CompareLogic(new ComparisonConfig { MaxDifferences = 100 }); T deserialized = subject.Deserialize <T>(payload); IResultData result = null; ComparisonResult comparision = comparer.Compare(template, deserialized); if (comparision.AreEqual == false) { result = new InvalidComparisionResult(comparision.DifferencesString); } return(result); }
public IResult Execute(ITimes times) { Log.Debug("New AppDomain {Subject}/{Procedure}", this.subject.Name, this.procedure.Name); AppDomain domain = AppDomain.CreateDomain(String.Join("-", [email protected], this.subject.Name, this.procedure.Name)); try { Log.Information("Executing {Subject}/{Procedure} on thread {ThreadId}", this.subject.Name, this.procedure.Name); Proxy proxy = (Proxy)domain.CreateInstanceFromAndUnwrap(this.GetType().Assembly.CodeBase, typeof(Proxy).FullName); IResultData data = proxy.Execute(this.@case, this.procedure, this.subject, times); IResult result = new Result(this.@case, this.procedure, this.subject, data); return(result); } finally { Log.Information("Executing {Subject}/{Procedure} on thread {ThreadId} completed", this.subject.Name, this.procedure.Name); AppDomain.Unload(domain); } }
public void SetCollection() { // Arrange var sortingModule = new SortingModule(); var listOfItems = new List <UserTestingClass> { new UserTestingClass { Id = Guid.NewGuid() } }; var resultData = new ResultData(); // Act IResultData result = sortingModule.ConstructResult(listOfItems, resultData); // Assert Assert.IsNotNull(result); var firstDataItem = result.Data as List <UserTestingClass>; Assert.AreEqual(listOfItems[0].Id, firstDataItem[0].Id); }
}// AddMenuItems internal override void MenuCommand(int iCommandID, Object oResultItem) { if (iCommandID == COMMANDS.ADD_GACASSEMBLY) { // Pop up a file dialog so the user can find an assembly OpenFileDialog fd = new OpenFileDialog(); fd.Title = CResourceStore.GetString("CSharedAssemblies:AddAssemFDTitle"); fd.Filter = CResourceStore.GetString("AssemFDMask"); fd.Multiselect = true; System.Windows.Forms.DialogResult dr = fd.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { for (int i = 0; i < fd.FileNames.Length; i++) { if (!AddAssemToFusion(fd.FileNames[i])) { // If we can't add assemblies due to an access denied, then // just stop trying with our list of assemblies break; } } } // Find the assembly we just added in order to select it int nCount = getNumRows(); for (int i = 0; i < nCount; i++) { if (TurnCodebaseToFilename(GetAssemInfo(i).Codebase).ToLower(CultureInfo.InvariantCulture).Equals(fd.FileNames[0].ToLower(CultureInfo.InvariantCulture))) { IResultData ResultData = (IResultData)CNodeManager.CConsole; RESULTDATAITEM rdi = new RESULTDATAITEM(); rdi.mask = RDI.STATE; rdi.nCol = 0; rdi.nIndex = i; rdi.nState = LVIS.SELECTED; ResultData.SetItem(ref rdi); break; } } } else if (iCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (iCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskPad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForSharedAssem", "yes"); RefreshResultView(); } else if (iCommandID == COMMANDS.REFRESH_DISPLAY) { RefreshResultView(); } }// MenuCommand
}// GetIColumnResultView //------------------------------------------------- // onShow // // This function will be used only if a column view is // to be presented in the result pane. //------------------------------------------------- internal void onShow(IConsole2 Console, IntPtr arg, IntPtr param) { if ((int)arg == 0) { Leaving(); } // Let's make sure we do have a list view item to display if ((int)arg > 0 && m_oResults != null && m_oResults is IColumnResultView) { IColumnResultView crv = (IColumnResultView)m_oResults; // If we're here then we have stuff to add to the result // view (beyond the standard view) // Query the Conole for a couple interfaces to use IHeaderCtrl HeaderCtrl = (IHeaderCtrl)Console; IResultData ResultData = (IResultData)Console; // Add/Remove Multi-Select ability if (m_fAllowMultiSelectResults) { ResultData.ModifyViewStyle(0, MMC.SINGLESEL); } else { ResultData.ModifyViewStyle(MMC.SINGLESEL, 0); } // Let's put in the column titles and find out how wide // each column should be int iNumCols = crv.getNumColumns(); int iNumRows = crv.getNumRows(); for (int i = 0; i < iNumCols; i++) { int iMaxLength = crv.getColumnTitles(i).Length; for (int j = 0; j < iNumRows; j++) { if (crv.getValues(j, i) != null) { int iTempLength = crv.getValues(j, i).Length; if (iTempLength > iMaxLength) { iMaxLength = iTempLength; } } } int nWidth = GetColumnWidth(i, iMaxLength); HeaderCtrl.InsertColumn(i, crv.getColumnTitles(i), LVCFMT.LEFT, nWidth); } RESULTDATAITEM rdi = new RESULTDATAITEM(); for (int n = 0; n < iNumRows; n++) { rdi.mask = RDI.STR | RDI.PARAM; rdi.nImage = crv.GetImageIndex(n); // If we have a valid image, tell MMC to display it. if (rdi.nImage != -1) { rdi.mask |= RDI.IMAGE; } rdi.str = (IntPtr)(-1); rdi.nCol = 0; // We're doing the lParam a little differently. The low word contains the cookie // for this node, while the high word contains the row number + 1 we're inserting rdi.lParam = m_iCookie | ((n + 1) << 16); ResultData.InsertItem(ref rdi); } } }// onShow
private void SetResultViewMode() { IResultData resultData = Snapin.ResultViewConsole as IResultData; resultData.SetViewMode((int)GetResultViewMode()); }
internal ResultDataItem GetSelectedItem(IResultData resultData) { // Start at the first item. return(GetSelectedItem(resultData, -1)); }
}// Destroy //------------------------------------------------- // QueryDataObject // // When MMC wants a data object for a specific cookie, // this function will be called. //------------------------------------------------- public void QueryDataObject(int cookie, uint type, out IDataObject ppDataObject) { // Our cookies for results are a little bit 'munged' // The low word is the actual cookie, while the high word is // the row # of the result item (1-based) // Crap.... we have a multi-selection to worry about if (cookie == MMC.MULTI_SELECT_COOKIE) { IResultData ResultData = (IResultData)m_ucsole; ArrayList al = new ArrayList(); bool isLastSelected = false; int nGoodCookie = -1; int nIndex = -1; while (!isLastSelected) { RESULTDATAITEM rdi = new RESULTDATAITEM(); rdi.mask = RDI.STATE; rdi.nCol = 0; rdi.nIndex = nIndex; rdi.nState = LVIS.SELECTED; ResultData.GetNextItem(ref rdi); if (rdi.nIndex != -1) { al.Add((int)((rdi.lParam & 0xFFFF0000) >> 16)); nGoodCookie = rdi.lParam; nIndex = rdi.nIndex; } else { isLastSelected = true; } } if (nGoodCookie != -1) { int iRealCookie = nGoodCookie & 0x0000FFFF; CNode node = CNodeManager.GetNode(iRealCookie); CDO cdo = new CDO(node); cdo.Data = al; ppDataObject = cdo; } else { ppDataObject = null; } } else { int iRealCookie = cookie & 0x0000FFFF; CNode node = CNodeManager.GetNode(iRealCookie); CDO cdo = new CDO(node); Object o; if (node.ResultQDO(cookie, out o)) { cdo.Data = o; } else { cdo.Data = (int)((cookie & 0xFFFF0000) >> 16); } ppDataObject = cdo; } }// QueryDataObject
private void DeleteResultItem(IntPtr id) { IResultData resultData = Snapin.ResultViewConsole as IResultData; resultData.DeleteItem(id, 0); }
public ResultDataValidator(COMPARATIONTYPE filtter, IResultData rdToCheck, IResultData rdToCheckAgainst) { this.rdToCheck = rdToCheck; this.rdToCheckAgainst = rdToCheckAgainst; comparatorFiltter = new ComparatorFiltter(filtter); }
/// <summary> /// Create and return the <see cref="SWMM5IntFileBridge"/> /// </summary> public IResultBridge Create(IResultData resultData) { return(new SWMM5IntFileBridge(resultData, _asRR)); }