public DropboxFileSystem (Session session) { this.session = session; sharedClient = new RestClient (session); UserId = session.UserIds.FirstOrDefault () ?? "Unknown"; FileExtensions = new System.Collections.ObjectModel.Collection<string> (); }
public void TestPrm_Name_Complex_In_Series() { System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll = new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>(); coll.Add(null); coll.Add(new System.Management.Automation.PSObject("autoclosed")); coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 1")); coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 2")); coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 3")); coll.Add(new System.Management.Automation.PSObject("autoclosed")); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"$null = New-TmxTestSuite -Name 'suite%%`1 1'; " + @"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 1'; " + @"$null = Add-TmxTestResultDetail -TestResultDetail 'detail 1'; " + @"$null = New-TmxTestSuite -Name 'suite%%`2 2'; " + @"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 2'; " + @"$null = Close-TmxTestResult -Name 'test result`r`n%% 1' -TestPassed; " + @"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 3'; " + @"$null = Close-TmxTestResult -Name 'test result`r`n%% 2' -TestPassed; " + @"$null = Add-TmxTestResultDetail -TestResultDetail 'detail 1'; " + @"$null = New-TmxTestSuite -Name 'suite%%`3 3'; " + @"$null = New-TmxTestSuite -Name 'suite%%`4 4'; " + @"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 4'; " + @"$null = Add-TmxTestScenario -Name 'scenario`r`n%% 2'; " + @"$null = New-TmxTestSuite -Name 'suite%%`5 5'; " + @"$null = Close-TmxTestResult -Name 'test result`r`n%% 3' -TestPassed; " + @"Search-TmxTestResult -OrderById | %{$_.Name;}", coll); }
public void TestPrm_FilterDescriptionContains_Descending() { System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll = new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>(); coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 1")); coll.Add(new System.Management.Automation.PSObject("test result`r`n%% 3")); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"$null = New-TMXTestSuite -Name 'suite%%`1 1'; " + @"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 1'; " + @"$null = Add-TMXTestResultDetail -TestResultDetail 'detail 1'; " + @"$null = New-TMXTestSuite -Name 'suite%%`2 2'; " + @"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 2'; " + @"$null = Close-TMXTestResult -Name 'test result`r`n%% 1' -Description 'abc' -TestPassed; " + @"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 3'; " + @"$null = Close-TMXTestResult -Name 'test result`r`n%% 2' -Id 01 -TestPassed; " + @"$null = Add-TMXTestResultDetail -TestResultDetail 'detail 1'; " + @"$null = New-TMXTestSuite -Name 'suite%%`3 3'; " + @"$null = New-TMXTestSuite -Name 'suite%%`4 4'; " + @"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 4'; " + @"$null = Add-TMXTestScenario -Name 'scenario`r`n%% 2'; " + @"$null = New-TMXTestSuite -Name 'suite%%`5 5'; " + @"$null = Close-TMXTestResult -Name 'test result`r`n%% 3' -Description 'cab' -TestPassed; " + @"$null = Close-TMXTestResult -Name 'a' -Id '003' -Description 'ccc' -TestPassed; " + @"Search-TMXTestResult -FilterDescriptionContains 'ab' -Descending | %{$_.Name;}", coll); }
public void TestMercator_1SP_Projection() { CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); //System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(5); System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", 110)); parameters.Add(new ProjectionParameter("scale_factor", 0.997)); parameters.Add(new ProjectionParameter("false_easting", 3900000)); parameters.Add(new ProjectionParameter("false_northing", 900000)); IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); SharpMap.Geometries.Point pGeo = new SharpMap.Geometries.Point(120, -3); SharpMap.Geometries.Point pUtm = trans.MathTransform.Transform(pGeo); SharpMap.Geometries.Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); SharpMap.Geometries.Point expected = new Point(5009726.58, 569150.82); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void TestAlbersProjection() { CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); //System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(5); System.Collections.ObjectModel.Collection<ProjectionParameter> parameters = new System.Collections.ObjectModel.Collection<ProjectionParameter>(); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_origin", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); SharpMap.Geometries.Point pGeo = new SharpMap.Geometries.Point(-75, 35); SharpMap.Geometries.Point pUtm = trans.MathTransform.Transform(pGeo); SharpMap.Geometries.Point pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); SharpMap.Geometries.Point expected = new Point(1885472.7, 1535925); Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), String.Format("Albers forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
/// <summary> /// Create a global instance of this panel /// </summary>> public static Drives CreateInstance() { if (panelInstance == null) { panelInstance = new Drives(); // Get Information info.Initialize(InformationClass.Initializers.GetDriveInformation); info.Initialize(InformationClass.Initializers.GetVolumeInfo); VolumeLetter = info.VolumeLetter; VolumeType = info.VolumeType; _VolumeLabel = info.VolumeLabel; VolumeFileSystem = info.VolumeFileSystem; VolumeTotalSize = info.VolumeTotalSize; VolumeUsedSpace = info.VolumeUsedSpace; VolumeFreeSpace = info.VolumeFreeSpace; VolumePercentFreeSpace = info.VolumePercentFreeSpace; VolumeReady = info.VolumeReady; DriveCapacity = info.DriveCapacity; DriveInterface = info.DriveInterface; DriveModelNo = info.DriveModelNo; DriveStatus = info.DriveStatus; CDDrive = info.CDDrive; CDMediaSize = info.CDMediaSize; CDModel = info.CDModel; CDStatus = info.CDStatus; } return panelInstance; }
private void initRuby() { ScriptRuntimeSetup runtimeSetup = ScriptRuntimeSetup.ReadConfiguration(); var languageSetup = IronRuby.RubyHostingExtensions.AddRubySetup(runtimeSetup); runtimeSetup.DebugMode = false; runtimeSetup.PrivateBinding = false; runtimeSetup.HostType = typeof(RhoHost); languageSetup.Options["NoAdaptiveCompilation"] = false; languageSetup.Options["CompilationThreshold"] = 0; languageSetup.Options["Verbosity"] = 2; m_runtime = IronRuby.Ruby.CreateRuntime(runtimeSetup); m_engine = IronRuby.Ruby.GetEngine(m_runtime); m_context = (RubyContext)Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetLanguageContext(m_engine); m_context.ObjectClass.SetConstant("RHO_WP7", 1); m_context.ObjectClass.AddMethod(m_context, "__rhoGetCallbackObject", new RubyLibraryMethodInfo( new[] { LibraryOverload.Create(new Func<System.Object, System.Int32, System.Object>(RhoKernelOps.__rhoGetCallbackObject), false, 0, 0) }, RubyMethodVisibility.Public, m_context.ObjectClass )); m_context.Loader.LoadAssembly("RhoRubyLib", "rho.rubyext.rubyextLibraryInitializer", true, true); System.Collections.ObjectModel.Collection<string> paths = new System.Collections.ObjectModel.Collection<string>(); paths.Add("lib"); paths.Add("apps/app"); m_engine.SetSearchPaths(paths); }
/// <summary> /// Initialises the view. /// </summary> /// <param name="grid">The layoutRoot grid.</param> /// <param name="columnManager">Look ahead view column manager.</param> public void InitializeView(Grid grid, ColumnManager columnManager) { System.Collections.ObjectModel.Collection<ColumnManager> columns = new System.Collections.ObjectModel.Collection<ColumnManager>(); columns.Add(columnManager); this.view = new ColumnView(grid, columns, true); }
private void initRuby() { ScriptRuntimeSetup runtimeSetup = ScriptRuntimeSetup.ReadConfiguration(); var languageSetup = IronRuby.RubyHostingExtensions.AddRubySetup(runtimeSetup); runtimeSetup.DebugMode = false; runtimeSetup.PrivateBinding = false; runtimeSetup.HostType = typeof(RhoHost); languageSetup.Options["NoAdaptiveCompilation"] = false; languageSetup.Options["CompilationThreshold"] = 0; languageSetup.Options["Verbosity"] = 2; m_runtime = IronRuby.Ruby.CreateRuntime(runtimeSetup); m_engine = IronRuby.Ruby.GetEngine(m_runtime); m_context = (RubyContext)Microsoft.Scripting.Hosting.Providers.HostingHelpers.GetLanguageContext(m_engine); m_context.ObjectClass.SetConstant("RHO_WP7", 1); m_context.Loader.LoadAssembly("RhoRubyLib", "rho.rubyext.rubyextLibraryInitializer", true, true); System.Collections.ObjectModel.Collection<string> paths = new System.Collections.ObjectModel.Collection<string>(); paths.Add("lib"); paths.Add("apps/app"); m_engine.SetSearchPaths(paths); }
public System.Collections.ObjectModel.Collection<UIElement> getAssociations() { System.Collections.ObjectModel.Collection<UIElement> asses = new System.Collections.ObjectModel.Collection<UIElement>(); if ((this.Child as StackPanel).Children.Count > 1) { Canvas assocCanvas = null; foreach (UIElement u in (this.Child as StackPanel).Children) if (u is Canvas) { assocCanvas = u as Canvas; break; } if (assocCanvas != null) { foreach (UIElement u in assocCanvas.Children) { if ((u as VisualElement).Content is UMLAssociation) { asses.Add(u); //((u as VisualElement).Content as UMLAssociation).drawArrow(new Point(0, 0), new Point(300, 300)); //Canvas.SetTop((u as VisualElement), 30); //Canvas.SetLeft((u as VisualElement), 5); //Canvas.SetZIndex(u, 6); } } } } return asses; }
public void TestPrm_Name_Simple_In_Series() { System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll = new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>(); coll.Add(new System.Management.Automation.PSObject("scenario1")); coll.Add(new System.Management.Automation.PSObject("scenario2")); coll.Add(new System.Management.Automation.PSObject("scenario4")); coll.Add(new System.Management.Automation.PSObject("scenario2")); coll.Add(new System.Management.Automation.PSObject("scenario3")); coll.Add(new System.Management.Automation.PSObject("scenario2")); coll.Add(new System.Management.Automation.PSObject("scenario5")); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"$null = New-TmxTestSuite -Name suite1; " + @"$null = Add-TmxTestScenario -Name scenario1; " + @"$null = New-TmxTestSuite -Name suite2; " + @"$null = New-TmxTestSuite -Name suite3; " + @"$null = Add-TmxTestScenario -Name scenario2; " + @"$null = Add-TmxTestScenario -Name scenario3; " + @"$null = New-TmxTestSuite -Name suite4; " + @"$null = Add-TmxTestScenario -Name scenario4; " + @"$null = Add-TmxTestScenario -Name scenario2; " + @"$null = Add-TmxTestScenario -Name scenario5; " + @"$null = New-TmxTestSuite -Name suite5; " + @"$null = Add-TmxTestScenario -Name scenario2; " + @"Search-TmxTestScenario -OrderById | %{$_.Name;}", coll); }
public IClient(NetConnection conn, Game gameInstance) : base(conn,gameInstance) { Que = new System.Collections.ObjectModel.Collection<qmsg>(); InternalQue = new System.Collections.ObjectModel.Collection<qmsg>(); Connection = conn; WH = new System.Threading.AutoResetEvent(false); }
private void Ancestors_1(string driverName) { System.Collections.ObjectModel.Collection<PSObject> coll = new System.Collections.ObjectModel.Collection<PSObject>(); //coll.Add((new PSObject(" Value1\r\n Value 2\r\n Value \\3\r\n Value /4\r\n "))); coll.Add((new PSObject("div3\r\nMy first paragraph.\r\nMy second paragraph."))); coll.Add((new PSObject("div2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph."))); coll.Add((new PSObject("div1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph."))); coll.Add((new PSObject("My First Heading\r\ndiv1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph."))); coll.Add((new PSObject("My First Heading\r\ndiv1\r\ndiv2\r\ndiv3\r\nMy first paragraph.\r\nMy second paragraph."))); // coll.Add((new PSObject("Test results 26.07.2012 16:16 // Value1 // Value 2 // Value \3 // Value /4 // // Value1 // Value 2 // Value \3 // Value /4 // // Value1 // Value 2 // Value \3 // Value /4 // //Value1 Value 2 Value \3 Value /4 // Value1 // Value 2 // Value \3 // Value /4 // //Value1 Value 2 Value \3 Value /4 //Suites:1 Passed:0 Failed:1 Not tested:0 //Scenarios:2 Passed:0 Failed:2 Not tested:0 //Test cases:21 Passed:11 Failed:7 Not tested:3 Time spent:6 seconds //4 cases of non-critical issues are counted as Passed //111 suite1 FAILED //Scenarios:2 Passed:0 Failed:2 Not tested:0 //Test cases:21 Passed:11 Failed:7 Not tested:3 Time spent:6 seconds //description description description description description description description description description description> //))); //coll.Add((new PSObject(Settings.TestFile05Controls1ElementSelect01Value03Name))); //coll.Add((new PSObject(Settings.TestFile05Controls1ElementSelect01Value04Name))); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"Start-SeWebDriver -DriverName '" + driverName + @"' | Enter-SeURL -URL '" + MiddleLevelCode.GetURLFromPath(System.IO.Path.GetFullPath(Settings.TestFile06Controls1)) + @"' | Get-SeWebElement -XPath '" + Settings.TestFile06Controls1Element01XPath + //@"' | Get-SeWebElementAncestors | %{ $_ | Read-SeWebElementText; }", @"' | Get-SeWebElementAncestors | Read-SeWebElementText;", coll); }
private void AddViews() { //TODO: create the Module views, add them to the WorkItem and show them in // a Workspace. See: ms-help://MS.VSCC.v80/MS.VSIPCC.v80/ms.practices.scsf.2007may/SCSF/html/03-01-040-How_to_Add_a_View_with_a_Presenter.htm System.Collections.ObjectModel.Collection<string> cl = new System.Collections.ObjectModel.Collection<string>(); cl.Add(ACOT.Infrastructure.Interface.Constants.ModuleNames.ChkAddrModule); cl.Add if (OnModuleLoad != null) OnModuleLoad(this, new EventArgs<System.Collections.ObjectModel.Collection<string>>(cl)); }
public System.Collections.ObjectModel.Collection<System.Web.UI.WebControls.ListItem> GetCurrencies() { System.Collections.ObjectModel.Collection<System.Web.UI.WebControls.ListItem> values = new System.Collections.ObjectModel.Collection<System.Web.UI.WebControls.ListItem>(); foreach (Currency currency in Data.Helpers.Currencies.GetCurrencies(AppUsers.GetCurrentUserDB())) { values.Add(new System.Web.UI.WebControls.ListItem(currency.CurrencyCode, currency.CurrencyCode)); } return values; }
public System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> RunCommand(CmdletParameterSetBase paramSet, out System.Collections.ObjectModel.Collection<object> errors) { errors = new System.Collections.ObjectModel.Collection<object>(); System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> results = null; System.Text.StringBuilder cmdString = new System.Text.StringBuilder(paramSet.Cmdlet); System.Text.StringBuilder parameterValueClearScriptBuilder = new System.Text.StringBuilder(); foreach (CmdletParameterSwitchValuePair parameter in paramSet.Parameters) { if (parameter.Value != null && parameter.Value.IsSet) { if (parameter.Value is CmdletSwitchParameter) { cmdString.AppendFormat(" -{0}", parameter.ParameterSwitch); } else { string parameterSting = System.String.Empty, parameterGuidString; switch (parameter.Value.ParameterValueType) { case ParameterValueTypeEnum.String: parameterSting = (string)parameter.Value.ValueObject; break; case ParameterValueTypeEnum.Object: parameterGuidString = System.Guid.NewGuid().ToString("N"); parameterSting = System.String.Format("${0}", parameterGuidString); runspace.SessionStateProxy.SetVariable(parameterGuidString, parameter.Value.ValueObject); parameterValueClearScriptBuilder.AppendLine(System.String.Format("{0} = $NULL", parameterSting)); break; default: System.Diagnostics.Debug.Assert(false, "Parameter object is not set properly. This error should never be seen."); break; } cmdString.AppendFormat(" -{0} {1}", parameter.ParameterSwitch, parameterSting); } } try { using (System.Management.Automation.Runspaces.Pipeline pipeline = runspace.CreatePipeline(cmdString.ToString())) { results = pipeline.Invoke(); errors = pipeline.Error.ReadToEnd(); } } finally { using (System.Management.Automation.Runspaces.Pipeline pipeline = runspace.CreatePipeline(parameterValueClearScriptBuilder.ToString())) { pipeline.Invoke(); } } } return results; }
private CascadingDropDownNameValue[] GetValues(System.Data.DataTable table) { System.Collections.ObjectModel.Collection<CascadingDropDownNameValue> values = new System.Collections.ObjectModel.Collection<CascadingDropDownNameValue>(); foreach(System.Data.DataRow dr in table.Rows) { values.Add(new CascadingDropDownNameValue(dr["party"].ToString(), dr["party_code"].ToString())); } return values.ToArray(); }
protected void Page_Load(object sender, EventArgs e) { System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>> parameters = new System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>>(); System.Collections.ObjectModel.Collection<KeyValuePair<string, string>> list = new System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>(); list.Add(new KeyValuePair<string, string>("@transaction_master_id", this.Request["TranId"])); parameters.Add(list); parameters.Add(list); DirectPurchaseInvoiceReport.ParameterCollection = parameters; }
protected void Page_Load(object sender, EventArgs e) { System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>> parameters = new System.Collections.ObjectModel.Collection<System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>>(); System.Collections.ObjectModel.Collection<KeyValuePair<string, string>> list = new System.Collections.ObjectModel.Collection<KeyValuePair<string, string>>(); list.Add(new KeyValuePair<string, string>("@non_gl_stock_master_id", this.Request["TranId"])); parameters.Add(list); parameters.Add(list); SalesQuotationReport.ParameterCollection = parameters; }
public CascadingDropDownNameValue[] GetStockItems(string knownCategoryValues, string category) { System.Collections.ObjectModel.Collection<CascadingDropDownNameValue> values = new System.Collections.ObjectModel.Collection<CascadingDropDownNameValue>(); using(System.Data.DataTable table = MixERP.Net.BusinessLayer.Helpers.FormHelper.GetTable("core", "items", "maintain_stock", "true")) { foreach(System.Data.DataRow dr in table.Rows) { values.Add(new CascadingDropDownNameValue(dr["item_name"].ToString(), dr["item_code"].ToString())); } return values.ToArray(); } }
public void TestPrm_FilterDescriptionContains_Descending() { System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll = new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>(); coll.Add(new System.Management.Automation.PSObject("suite4")); coll.Add(new System.Management.Automation.PSObject("suite1")); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"$null = New-TMXTestSuite -Name suite1 -Description 'abc'; " + @"$null = New-TMXTestSuite -Name suite2 -Description 'bac'; " + @"$null = New-TMXTestSuite -Name suite3; " + @"$null = New-TMXTestSuite -Name suite4 -Description 'cab'; " + @"$null = New-TMXTestSuite -Name suite5 -Description 'bac'; " + @"Search-TMXTestSuite -FilterDescriptionContains 'ab' -Descending | %{$_.Name;}", coll); }
private static IEnumerable<CookieHeaderValue> GetCookies(HttpRequestHeaders header) { var result = new System.Collections.ObjectModel.Collection<CookieHeaderValue>(); IEnumerable<string> cookies; if (header.TryGetValues("Cookie", out cookies)) { foreach (string cookie in cookies) { CookieHeaderValue cookieHeaderValue; if (CookieHeaderValue.TryParse(cookie, out cookieHeaderValue)) result.Add(cookieHeaderValue); } } return result; }
/// <summary> /// Create a global instance of this panel /// </summary>> public static Sound CreateInstance() { if (panelInstance == null) { panelInstance = new Sound(); // Get information. info.Initialize(InformationClass.Initializers.GetSoundInfo); SndNumberOfControllers = info.SndNumberOfControllers; SndManufacturer = info.SndManufacturer; SndController = info.SndController; SndDmaBufferSize = info.SndDmaBufferSize; } return panelInstance; }
public List<Entities.RevisionRange> Execute(Entities.Branch branch, string search, StringBuilder logMessages, List<Entities.RevisionRange> eligible) { if (logMessages == null) { logMessages = new StringBuilder(); } List<Entities.RevisionRange> ranges = new List<RevisionRange>(); Dictionary<string, string> settings = settingsBLL.Get(); string userName = SettingsHelper.ValidateUsername(settings); string password = SettingsHelper.ValidatePassword(settings); System.Collections.ObjectModel.Collection<SharpSvn.SvnLogEventArgs> logEntries = new System.Collections.ObjectModel.Collection<SharpSvn.SvnLogEventArgs>(); using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default()) { client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password); SharpSvn.SvnLogArgs args = new SharpSvn.SvnLogArgs(); client.GetLog(new Uri(branch.Url), out logEntries); } foreach (var logEntry in logEntries) { if(logEntry.LogMessage.ToLower().Contains(search.ToLower() + " ")) { var range = new RevisionRange { StartRevision = (logEntry.Revision - 1).ToString(), EndRevision = logEntry.Revision.ToString() }; if(eligible.FindIndex(x => x.StartRevision == range.StartRevision && x.EndRevision == range.EndRevision) > -1) { logMessages.AppendLine(logEntry.LogMessage); logMessages.AppendLine("................................"); ranges.Add(range); } } } return ranges; }
/// <summary> /// Create a global instance of this panel /// </summary>> public static Services CreateInstance() { if (panelInstance == null) { panelInstance = new Services(); // Get services info. info.Initialize(InformationClass.Initializers.GetServiceInfo); ServiceDisplayName = info.ServiceDisplayName; ServiceStartMode = info.ServiceStartMode; ServiceState = info.ServiceState; ServicePathName = info.ServicePathName; ServiceDescription = info.ServiceDescription; } return panelInstance; }
public CascadingDropDownNameValue[] GetUnits(string knownCategoryValues, string category) { StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); string itemCode = kv["Item"]; System.Collections.ObjectModel.Collection<CascadingDropDownNameValue> values = new System.Collections.ObjectModel.Collection<CascadingDropDownNameValue>(); using (System.Data.DataTable table = MixERP.Net.BusinessLayer.Core.Units.GetUnitViewByItemCode(itemCode)) { foreach (System.Data.DataRow dr in table.Rows) { values.Add(new CascadingDropDownNameValue(dr["unit_name"].ToString(), dr["unit_id"].ToString())); } return values.ToArray(); } }
public DesignForm(Form originalForm, System.Collections.ObjectModel.Collection<string> propertiesToDesign) { // Copy parameters to fields _originalForm = originalForm; _propertiesToDesign = propertiesToDesign; // Create hashtables _reparentedControls = new Hashtable(); _customTypeDescriptors = new Hashtable(); // Create the DesignSurface and get the View from it; _surface = new DesignSurface(typeof(Form)); // Setup UI, note, this can't be called until _surface is non-null SetupUI(); // Get the IDesignerHost for the surface _host = _surface.GetService(typeof(IDesignerHost)) as IDesignerHost; // Get the ISelectionService and hook the SelectionChanged event _selection = _surface.GetService(typeof(ISelectionService)) as ISelectionService; if (_selection != null) { _selection.SelectionChanged += new EventHandler(SelectionChanged); } // Get the rootForm from the IDesignerHost Form rootForm = _host.RootComponent as Form; if (rootForm != null) { // Clone the Form's properties CloneControlProperties(_originalForm, rootForm); // Now that a customTypeDescriptor is around for the Form, use it SampleCustomTypeDescriptor formDesc = _customTypeDescriptors[rootForm] as SampleCustomTypeDescriptor; if (formDesc != null) { _grid.SelectedObject = formDesc; } // Clone the controls on the Form CloneControlsRecursive(_originalForm.Controls, rootForm); } }
public Settings RegistryRead (Settings settings) { var settingsInformation = new List<RegistryEntry>(); if (App.IsWindowsMachine) settingsInformation = (new Settings()).AsEnumerable(SettingsReturnType.Essential).ReadFromRegistry(registryRootValue, App.IsDebugging).ToList(); else { var settingsFromFile = new System.Collections.ObjectModel.Collection<string>().AddFileContents(RegistryFile); if(settingsFromFile.Any()) { for (var position = settingsFromFile.GetEnumerator(); position.MoveNext();) { var entry = position.Current.Split(new[] { RegistryEntry.Separator }, StringSplitOptions.RemoveEmptyEntries); settingsInformation.Add(new RegistryEntry(entry.First(), entry.Last())); } } } return settings.Replace(settingsInformation); }
public void TestPrm_Id_Numeric() { System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject> coll = new System.Collections.ObjectModel.Collection<System.Management.Automation.PSObject>(); coll.Add(new System.Management.Automation.PSObject("1")); coll.Add(new System.Management.Automation.PSObject("2")); coll.Add(new System.Management.Automation.PSObject("3")); coll.Add(new System.Management.Automation.PSObject("4")); coll.Add(new System.Management.Automation.PSObject("5")); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"$null = New-TmxTestSuite -Name abc1 -Id 1; " + @"$null = New-TmxTestSuite -Name abc2 -Id 2; " + @"$null = New-TmxTestSuite -Name abc3 -Id 3; " + @"$null = New-TmxTestSuite -Name abc4 -Id 4; " + @"$null = New-TmxTestSuite -Name abc5 -Id 5; " + @"Search-TmxTestSuite -OrderById | %{$_.Id;}", coll); }
private void TestPrm_Id_WebDriverInput(string driverName) { System.Collections.ObjectModel.Collection<PSObject> coll = new System.Collections.ObjectModel.Collection<PSObject>(); coll.Add((new PSObject(Settings.TestFile05Controls1ElementLink03Answer))); coll.Add((new PSObject(Settings.TestFile05Controls1ElementLink04Answer))); CmdletUnitTest.TestRunspace.RunAndEvaluateAreEqual( @"Start-SeWebDriver -DriverName '" + driverName + @"' | Enter-SeURL -URL '" + MiddleLevelCode.GetURLFromPath(System.IO.Path.GetFullPath(Settings.TestFile05Controls1)) + @"' | Get-SeWebElement -Id '" + Settings.TestFile05Controls1ElementLinkIds + //@"' | %{ $_ | Read-SeWebElementText; }", @"' | Read-SeWebElementText;", coll); }
/// <summary> /// <para xml:lang="en">Initializes a new instance of the <see cref="CameraImager" /> class.</para> /// </summary> public CameraImager() { this._technique = new System.Collections.ObjectModel.Collection <Technique>(); this._extra = new System.Collections.ObjectModel.Collection <Extra>(); }
public void AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, BindingParameterCollection parameters) { //No-op }
/// <summary> /// <para xml:lang="en">Initializes a new instance of the <see cref="Asset" /> class.</para> /// </summary> public Asset() { this._contributor = new System.Collections.ObjectModel.Collection <AssetContributor>(); }
/// <summary> /// <para xml:lang="en">Initializes a new instance of the <see cref="Tapered_Cylinder" /> class.</para> /// </summary> public Tapered_Cylinder() { this._extra = new System.Collections.ObjectModel.Collection <Extra>(); }
/// <summary> /// Default constructor. /// </summary> public PhotoInfo() { Notes = new System.Collections.ObjectModel.Collection <PhotoInfoNote>(); Tags = new System.Collections.ObjectModel.Collection <PhotoInfoTag>(); Urls = new System.Collections.ObjectModel.Collection <PhotoInfoUrl>(); }
protected override System.Collections.ObjectModel.Collection <object[]> CreateInstance(int initialCapacity) { System.Collections.ObjectModel.Collection <object[]> collection = default(System.Collections.ObjectModel.Collection <object[]>); collection = new System.Collections.ObjectModel.Collection <object[]>(); return(collection); }
public void SubjectBuffersDisconnected(IWpfTextView textView, ConnectionReason reason, System.Collections.ObjectModel.Collection <ITextBuffer> subjectBuffers) { }
private static void Restore(DBUtils dbu) { ICollection <BackupInfo> biColl = new System.Collections.ObjectModel.Collection <BackupInfo>(dbu.GetLocalBackups()); var toVersion = string.Empty; if (ArgsDict.Keys.Contains("ver")) { toVersion = ArgsDict["ver"]; } var tsFilter = string.Empty; if (ArgsDict.Keys.Contains("ts")) { tsFilter = ArgsDict["ts"]; } while (string.IsNullOrEmpty(toVersion)) { Console.Out.WriteLine("Local versions:"); foreach (var i in biColl.Select(p => p.Version).Distinct()) { Console.Out.WriteLine("\t{0}", i); } Console.Out.Write("Enter version to restore (or \"exit\" to exit):"); var res = Console.ReadLine(); if (res == "exit") { return; } var bi = biColl.Where(c => c.Version.Equals(res)).FirstOrDefault(); if (bi != null) { toVersion = bi.Version; } } DateTime ts = DateTime.MinValue; Dictionary <int, DateTime> tss = new Dictionary <int, DateTime>(); int num = 0; foreach (var bi in biColl.Where(c => c.Version.Equals(toVersion)).OrderByDescending(p => p.Timestamp)) { if (string.IsNullOrWhiteSpace(tsFilter) || bi.Timestamp.ToString(BaseUtils.TimestampFormatString).StartsWith(tsFilter, StringComparison.InvariantCultureIgnoreCase)) { tss.Add(num++, bi.Timestamp); } } while (ts == DateTime.MinValue) { Console.Out.WriteLine("Local backups for version {0}:", toVersion); foreach (var k in tss.Keys) { Console.Out.WriteLine("{0,3:D}\t{1}", k, tss[k]); } Console.Out.Write("Enter backup number to restore (or \"exit\" to exit):"); var res = Console.ReadLine(); if (res == "exit") { return; } num = -1; if (int.TryParse(res, out num) && tss.Keys.Contains(num)) { ts = tss[num]; } } if (!dbu.GetCurrentVersion().Equals("none", StringComparison.InvariantCultureIgnoreCase)) { Console.Out.Write("You are going to replace current version \"{0}\" with version \"{1} ({2})\".\nContinue(Y/N)?", dbu.GetCurrentVersion(), toVersion, ts); var ans = Console.ReadLine(); if (ans != "Y" && ans != "y") { return; } Console.Out.Write("Backup current version \"{0}\" before(Y/N)?", dbu.GetCurrentVersion()); ans = Console.ReadLine(); if (ans == "Y" || ans == "y") { dbu.BackupDBS(); } } dbu.RestoreDBS(toVersion, ts); }
public TestCasesLabels() { this._label = new System.Collections.ObjectModel.Collection <string>(); }
/// <summary> /// Checks if a given child nodes is contained in the given selection /// </summary> /// <param name="items"></param> /// <param name="node"></param> /// <returns></returns> public virtual bool HasSelectedChildNodes(System.Collections.ObjectModel.Collection <string> items, TreeNodePath node) { return(false); }
public void AddBindingParameters(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { throw new NotImplementedException(); }
/// <summary> /// This overload causes output to be /// written onto an Collection[PSObject] which is more useful /// in many circumstances than arraylist. /// </summary> /// <param name="resultCollection">The collection to write into.</param> internal Pipe(System.Collections.ObjectModel.Collection <PSObject> resultCollection) { Diagnostics.Assert(resultCollection != null, "resultCollection cannot be null"); _isRedirected = true; _resultCollection = resultCollection; }
/// <summary> /// Transform the current object to OwsContextAtomFeed. /// </summary> /// <returns>The ows context atom feed.</returns> public OwsContextAtomFeed ToOwsContextAtomFeed() { OwsContextAtomFeed feed = new OwsContextAtomFeed(); feed.Title = new TextSyndicationContent(this.Title); feed.Description = new TextSyndicationContent(this.Abstract); feed.Id = this.Id; feed.LastUpdatedTime = this.UpdateDate; feed.Language = this.Language; feed.Publisher = this.Publisher; feed.Copyright = new TextSyndicationContent(this.Rights); feed.Where = this.AreaOfInterest.ToGeoRssWhere(); feed.Date = this.TimeIntervalOfInterest; if (this.SpecReference != null) { feed.Links.Add(new Terradue.ServiceModel.Syndication.SyndicationLink(this.SpecReference, "profile", "OWC Context document specification reference", null, this.SpecReference.AbsoluteUri.Length)); } //TODO: validate type of ContextMetadata if (this.ContextMetadata != null) { feed.Links.Add(this.ContextMetadata); } if (this.Authors != null) { foreach (string author in this.Authors) { feed.Authors.Add(new SyndicationPerson(null, author, null)); } } if (this.Creator != null) { if (this.Creator.CreatorApplication != null) { feed.Generator = this.Creator.CreatorApplication.Title; } feed.Display = new Terradue.ServiceModel.Ogc.Owc.AtomEncoding.OwcDisplay(this.Creator.CreatorDisplay); } if (this.Keywords != null) { foreach (string kw in this.Keywords) { feed.Categories.Add(new SyndicationCategory(kw)); } } if (this.Resources != null) { System.Collections.ObjectModel.Collection <OwsContextAtomEntry> items = new System.Collections.ObjectModel.Collection <OwsContextAtomEntry>(); foreach (Resource resource in this.Resources) { items.Add(resource.ToContextAtomEntry()); } feed.Items = items; } // feed.ElementExtensions = Extension.ToAtom(); //TODO: implement return(feed); }
/// <summary> /// <para xml:lang="en">Initializes a new instance of the <see cref="ФайлДокументСвПродПерИнфПолФХЖ3" /> class.</para> /// </summary> public ФайлДокументСвПродПерИнфПолФХЖ3() { this._текстИнф = new System.Collections.ObjectModel.Collection <ТекстИнфТип>(); }
public void TestReceiveSmallMessages_Debatch3_CascadingValidationSingleStep_XML() { //Setting up the ILogger moq var loggerMock = TestMockReceiveStep.CreateLoggerMock(); Context context = new Context(loggerMock.Object); MockRequestResponseStep step = new MockRequestResponseStep(); step.Url = connectionUri.Uri.OriginalString; step.Encoding = "UTF-8"; step.ResponsePath = "TestResponse.xml"; step.Timeout = 30; step.DebatchedMessageCount = 3; step.ValidationMode = MultiMessageValidationMode.Cascading; // Setting up a validation step mock list var validationStepMockList = new List <Mock <SubStepBase> >(3); for (int i = 0; i < 3; i++) { var validationStepMock = TestMockReceiveStep.CreateSubStepMock(); var subStepCollection = new System.Collections.ObjectModel.Collection <SubStepBase>(); subStepCollection.Add(validationStepMock.Object); step.CascadingSubSteps.Add(i, subStepCollection); validationStepMockList.Add(validationStepMock); } //Calling Validate in order to start the step.Validate(context); //Setting up a manual reset event System.Threading.ManualResetEvent manualEvent = new System.Threading.ManualResetEvent(false); //here we queue up the step.Execute method in a separate thread as the execution model would actually be System.Threading.ThreadPool.QueueUserWorkItem((state) => { step.Execute(context); manualEvent.Set(); }); var responseMessageList = new List <Message>(3); string xml = "<SomeTestMessage><Element1 attribute1=\"attributeValue\"></Element1><Element2>Some element content</Element2></SomeTestMessage>"; for (int i = 0; i < 3; i++) { Message msg = GeneralTestHelper.CreateMessageWithBase64EncodedBody(xml, Encoding.UTF8); msg.Properties.Add("http://schemas.microsoft.com/BizTalk/2003/system-properties#IsSolicitResponse", true); var responseMsg = outboundHandler.Execute(msg, TimeSpan.FromSeconds(10)); responseMessageList.Add(responseMsg); } //Waiting for the manual event to be set manualEvent.WaitOne(1000); //string expected = ReadResponseFileContent("TestResponse.xml").Trim().Replace("\r\n", string.Empty).Replace("\t", string.Empty); //string actual = GeneralTestHelper.GetBodyAsString(responseMsg, Encoding.UTF8).Trim().Replace("\r\n", string.Empty).Replace("\t", string.Empty); //Assert.AreEqual(expected, actual, // "Response message is not matching the expected content"); Assert.AreEqual(3, responseMessageList.Count, "The number of response messages is incorrect."); loggerMock.Verify(l => l.LogData( It.Is <string>(s => !string.IsNullOrEmpty(s)), It.Is <string>(s => !string.IsNullOrEmpty(s))), Times.Exactly(6), "The LogData method was not called"); for (int i = 0; i < validationStepMockList.Count; i++) { var validationStepMock = validationStepMockList[i]; // For cascading validation mode each sub step should be called only once validationStepMock.Verify(vs => vs.Execute( It.Is <Stream>(s => s != null), It.Is <Context>(c => c != null)), Times.Exactly(1), "The SubStep mock was not called the expected number of times"); } }
/// <summary> /// <para xml:lang="en">Initializes a new instance of the <see cref="Gl_Pipeline_SettingsClip_Plane" /> class.</para> /// </summary> public Gl_Pipeline_SettingsClip_Plane() { this._value = new System.Collections.ObjectModel.Collection <double>(); }
public System.Collections.ObjectModel.Collection <System.Web.UI.WebControls.ListItem> GetCurrencies() { System.Collections.ObjectModel.Collection <System.Web.UI.WebControls.ListItem> values = new System.Collections.ObjectModel.Collection <System.Web.UI.WebControls.ListItem>(); foreach (Currency currency in Data.Helpers.Currencies.GetCurrencies()) { values.Add(new System.Web.UI.WebControls.ListItem(currency.CurrencyCode, currency.CurrencyCode)); } return(values); }
//Downloads program to PLC using specified file name and serial port private static void DownloadProgram(DF1Comm.DF1Comm df1, IGpioConnectionDriver driver, GpioConnection gpioConnection, ProcessorPin redLED, OutputPinConfiguration greenLED, string filename, string serialPort) { startIdleTimer(); //turn on red LED while update is in progress driver.Write(redLED, true); //set serial port on DF1 class to serial port specified, e.g. "/dev/ttyUSB0" df1.ComPort = serialPort; //detectBaudRate(df1); //Create new PLCFileDetails object System.Collections.ObjectModel.Collection <DF1Comm.DF1Comm.PLCFileDetails> PLCFiles = new System.Collections.ObjectModel.Collection <DF1Comm.DF1Comm.PLCFileDetails>(); //Create new PLCFile with the defaults DF1Comm.DF1Comm.PLCFileDetails PLCFile = default(DF1Comm.DF1Comm.PLCFileDetails); //try reading the program file using the filename specified try { //create fileReader to read from file fileReader = new System.IO.StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename)); //initialize string to hold contents of each line string line = null; //byte collection to hold raw data to send to PLC System.Collections.ObjectModel.Collection <byte> data = new System.Collections.ObjectModel.Collection <byte>(); //loop until the end of the file is reached //data is read in chunks of 3 lines //the first line is the FileType //the second line is the FileNumber //and the third line is the data //these are converted into a PLCFile and added to the PLCFiles collection while (!(fileReader.EndOfStream)) { //get the contents of the first line line = fileReader.ReadLine(); //convert hex ascii to byte for FileType PLCFile.FileType = Convert.ToByte(line, 16); //get the contents of the second line line = fileReader.ReadLine(); //convert hex ascii to byte for FileNumber PLCFile.FileNumber = Convert.ToByte(line, 16); //get the contents of the third line line = fileReader.ReadLine(); //clear the data collection data.Clear(); //loop through the entire line two characters at a time for (int i = 0; i <= line.Length / 2 - 1; i++) { //convert each two character ascii hex byte into a byte and add to data collection data.Add(Convert.ToByte(line.Substring(i * 2, 2), 16)); } //create byte array the same length as data collection byte[] dataC = new byte[data.Count]; //copy data collection to byte array data.CopyTo(dataC, 0); //assign byte array to PLCFile data property PLCFile.data = dataC; //add the PLCFile to the PLCFiles collection PLCFiles.Add(PLCFile); } //try to download the PLCfiles to the PLC try { df1.DownloadProgramData(PLCFiles); //set the PLC back to Run mode when download is complete df1.SetRunMode(); } //write the error to the console if an error occurs downloading the program catch (Exception ex) { Console.WriteLine("Error Downloading Program. " + ex.Message + " " + ex.StackTrace); rapidBlink(driver, redLED); startIdleTimer(); return; } //turn off red LED when update is complete driver.Write(redLED, false); //write a success message to the console if completed without errors Console.WriteLine("Successful Download"); //turn on green LED for 5 seconds when update is complete gpioConnection.Blink(greenLED, TimeSpan.FromSeconds(5)); //reset the idle shutdown timer startIdleTimer(); fileReader.Close(); return; } //catch errors reading the program file catch (Exception ex) { //write the error to the console if an error occurs reading the program file Console.WriteLine("Error Reading Program File for Download. " + ex.Message + " " + ex.StackTrace); //blink red LED to indicate problem with upload rapidBlink(driver, redLED); //reset the idle shutdown timer startIdleTimer(); if (fileReader != null) { fileReader.Close(); } return; } }
/// <summary> /// Constructs a new ControlReference array /// </summary> /// <param name="controls">Names of the controls to put in the array</param> public MVControlReferenceArrayAttribute(params string[] controls) : base() { this.myControls = new System.Collections.ObjectModel.Collection <string>(controls); }
public static ICollection <T> AsTrackable <T>(this System.Collections.ObjectModel.Collection <T> target, bool makeComplexPropertiesTrackable = true, bool makeCollectionPropertiesTrackable = true) where T : class { return(((ICollection <T>)target).AsTrackable(makeComplexPropertiesTrackable, makeCollectionPropertiesTrackable)); }
/// <summary> /// The expression will be executed in the remote computer if a /// remote runspace parameter or computer name is specified. If /// none other than command parameter is specified, then it /// just executes the command locally without creating a new /// remote runspace object. /// </summary> protected override void ProcessRecord() { if (ParameterSetName == DefinitionNameParameterSet) { // Get the Job2 object from the Job Manager for this definition name and start the job. string resolvedPath = null; if (!string.IsNullOrEmpty(_definitionPath)) { ProviderInfo provider = null; System.Collections.ObjectModel.Collection <string> paths = this.Context.SessionState.Path.GetResolvedProviderPathFromPSPath(_definitionPath, out provider); // Only file system paths are allowed. if (!provider.NameEquals(this.Context.ProviderNames.FileSystem)) { string message = StringUtil.Format(RemotingErrorIdStrings.StartJobDefinitionPathInvalidNotFSProvider, _definitionName, _definitionPath, provider.FullName); WriteError(new ErrorRecord(new RuntimeException(message), "StartJobFromDefinitionNamePathInvalidNotFileSystemProvider", ErrorCategory.InvalidArgument, null)); return; } // Only a single file path is allowed. if (paths.Count != 1) { string message = StringUtil.Format(RemotingErrorIdStrings.StartJobDefinitionPathInvalidNotSingle, _definitionName, _definitionPath); WriteError(new ErrorRecord(new RuntimeException(message), "StartJobFromDefinitionNamePathInvalidNotSingle", ErrorCategory.InvalidArgument, null)); return; } resolvedPath = paths[0]; } List <Job2> jobs = JobManager.GetJobToStart(_definitionName, resolvedPath, _definitionType, this, false); if (jobs.Count == 0) { string message = (_definitionType != null) ? StringUtil.Format(RemotingErrorIdStrings.StartJobDefinitionNotFound2, _definitionType, _definitionName) : StringUtil.Format(RemotingErrorIdStrings.StartJobDefinitionNotFound1, _definitionName); WriteError(new ErrorRecord(new RuntimeException(message), "StartJobFromDefinitionNameNotFound", ErrorCategory.ObjectNotFound, null)); return; } if (jobs.Count > 1) { string message = StringUtil.Format(RemotingErrorIdStrings.StartJobManyDefNameMatches, _definitionName); WriteError(new ErrorRecord(new RuntimeException(message), "StartJobFromDefinitionNameMoreThanOneMatch", ErrorCategory.InvalidResult, null)); return; } // Start job. Job2 job = jobs[0]; job.StartJob(); // Write job object to host. WriteObject(job); return; } if (_firstProcessRecord) { _firstProcessRecord = false; PSRemotingJob job = new PSRemotingJob(ResolvedComputerNames, Operations, ScriptBlock.ToString(), ThrottleLimit, _name); job.PSJobTypeName = s_startJobType; this.JobRepository.Add(job); WriteObject(job); } // inject input if (InputObject != AutomationNull.Value) { foreach (IThrottleOperation operation in Operations) { ExecutionCmdletHelper helper = (ExecutionCmdletHelper)operation; helper.Pipeline.Input.Write(InputObject); } } }
public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { _behavior.AddBindingParameters(serviceDescription, serviceHostBase, endpoints, bindingParameters); }
public void SubjectBuffersConnected(IWpfTextView textView, ConnectionReason reason, System.Collections.ObjectModel.Collection <ITextBuffer> subjectBuffers) { foreach (var buffer in subjectBuffers) { TrailingClassifier classifier; if (buffer.Properties.TryGetProperty(typeof(TrailingClassifier), out classifier)) { classifier.SetTextView(textView); } } }
void IServiceBehavior.AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { }
private static void UploadProgram(DF1Comm.DF1Comm df1, IGpioConnectionDriver driver, GpioConnection gpioConnection, ProcessorPin redLED, OutputPinConfiguration greenLED, string filename, string serialPort) { startIdleTimer(); //turn on red LED while update is in progress driver.Write(redLED, true); //set serial port on DF1 class to serial port specified, e.g. "/dev/ttyUSB0" df1.ComPort = serialPort; //detectBaudRate(df1); //Create new PLCFileDetails object System.Collections.ObjectModel.Collection <DF1Comm.DF1Comm.PLCFileDetails> PLCFiles = new System.Collections.ObjectModel.Collection <DF1Comm.DF1Comm.PLCFileDetails>(); //byte collection to hold raw data to send to PLC System.Collections.ObjectModel.Collection <byte> data = new System.Collections.ObjectModel.Collection <byte>(); //try to upload the PLCfiles from the PLC try { PLCFiles = df1.UploadProgramData(); try { fileWriter = new System.IO.StreamWriter(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filename)); for (int i = 0; i < PLCFiles.Count; i++) { fileWriter.WriteLine(String.Format("{0:x2}", PLCFiles[i].FileType)); fileWriter.WriteLine(String.Format("{0:x2}", PLCFiles[i].FileNumber)); for (int j = 0; j < PLCFiles[i].data.Length; j++) { fileWriter.Write(String.Format("{0:x2}", PLCFiles[i].data[j])); } fileWriter.WriteLine(); } fileWriter.Close(); } catch (Exception ex) { Console.WriteLine("Could not save PLC file. " + ex.Message + " " + ex.StackTrace); rapidBlink(driver, redLED); startIdleTimer(); if (fileWriter != null) { fileWriter.Close(); } return; } } //write the error to the console if an error occurs uploading the program catch (Exception ex) { Console.WriteLine("Could not upload PLC file. " + ex.Message + " " + ex.StackTrace); rapidBlink(driver, redLED); startIdleTimer(); return; } //turn off red LED when upload is complete driver.Write(redLED, false); //write a success message to the console if completed without errors Console.WriteLine("Successful Upload"); //turn on green LED for 5 seconds when update is complete gpioConnection.Blink(greenLED, TimeSpan.FromSeconds(5)); //reset the idle shutdown timer startIdleTimer(); return; }
public ValueTypeList() { this._item = new System.Collections.ObjectModel.Collection <ValueType>(); }
/// <summary> /// <para xml:lang="en">Initializes a new instance of the <see cref="MorphTargets" /> class.</para> /// </summary> public MorphTargets() { this._input = new System.Collections.ObjectModel.Collection <InputLocal>(); this._extra = new System.Collections.ObjectModel.Collection <Extra>(); }
public void TestReceiveSmallMessages_Debatch3_CascadingValidationSingleStep_XML() { // Setting up the ILogger moq var loggerMock = CreateLoggerMock(); Context context = new Context(loggerMock.Object); BizUnit. MockReceiveStep step = new MockReceiveStep(); step.Url = connectionUri.Uri.OriginalString; step.Encoding = "UTF-8"; step.Timeout = 30; step.DebatchedMessageCount = 3; step.ValidationMode = MultiMessageValidationMode.Cascading; // Setting up a validation step mock list var validationStepMockList = new List <Mock <SubStepBase> >(3); for (int i = 0; i < 3; i++) { var validationStepMock = CreateSubStepMock(); var validationStepsCollection = new System.Collections.ObjectModel.Collection <SubStepBase>(); validationStepsCollection.Add(validationStepMock.Object); step.CascadingSubSteps.Add(i, validationStepsCollection); } // Calling Validate in order to start the step.Validate(context); //Setting up a manual reset event System.Threading.ManualResetEvent manualEvent = new System.Threading.ManualResetEvent(false); //here we queue up the step.Execute method in a separate thread as the execution model would actually be System.Threading.ThreadPool.QueueUserWorkItem((state) => { step.Execute(context); manualEvent.Set(); }); string xml = "<SomeTestMessage><Element1 attribute1=\"attributeValue\"></Element1><Element2>Some element content</Element2></SomeTestMessage>"; for (int i = 0; i < 3; i++) { Message msg = GeneralTestHelper.CreateMessageWithBase64EncodedBody(xml, Encoding.UTF8); outboundHandler.Execute(msg, TimeSpan.FromSeconds(10)); } //Waiting for the manual event to be set manualEvent.WaitOne(1000); loggerMock.Verify(l => l.LogData( It.Is <string>(s => !string.IsNullOrEmpty(s)), It.Is <string>(s => !string.IsNullOrEmpty(s))), Times.AtLeastOnce(), "The LogData message was not called"); foreach (var validationStepMock in validationStepMockList) { validationStepMock.Verify(vs => vs.Execute( It.Is <Stream>(s => s != null), It.Is <Context>(c => c != null)), Times.Exactly(3), "The SubStep mock was not called the expected number of times"); } }
public void GetKnownCustomDataTypes(System.Collections.ObjectModel.Collection <Type> customDataTypes) { }
public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection <ServiceEndpoint> endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { throw new Exception("The method or operation is not implemented."); }