Ejemplo n.º 1
0
        protected Parameter(string scopeName, XmlNode parameterNode, ParameterSource source)
        {
            if (parameterNode == null)
            {
                throw new ArgumentNullException(nameof(parameterNode));
            }

            Source        = source;
            ParameterNode = parameterNode;
            ScopeName     = scopeName;
        }
Ejemplo n.º 2
0
        public void LoggerSuspendResume()
        {
            this.logger = SsmLogger.GetInstance(Environment.CurrentDirectory, MockEcuStream.PortName);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            LogProfile profile = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                profile.Add(parameter, parameter.Conversions[0]);
                if (profile.Columns.Count > 3)
                {
                    break;
                }
            }

            this.logStartCalls = 0;
            this.logEntryCalls = 0;
            this.logEndCalls   = 0;
            this.logErrorCalls = 0;

            this.logger.SetProfile(profile, database);
            this.logger.LogStart += this.LogStart;
            this.logger.LogEntry += this.LogEntry;
            this.logger.LogStop  += this.LogStop;
            this.logger.LogError += this.LogError;

            this.logger.StartLogging();
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.25));

            this.logger.Suspend();
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.25));
            int entriesBeforeSuspend = this.logEntryCalls;

            Debug.WriteLine("Entries before suspend: " + entriesBeforeSuspend.ToString());

            this.logger.Resume(TimeSpan.FromMilliseconds(250));
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.5));
            int entriesAfterSuspend = this.logEntryCalls;

            Debug.WriteLine("Entries after suspend: " + entriesAfterSuspend.ToString());

            this.logger.BeginStopLogging(NoOp, null);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.1));

            Assert.IsTrue(entriesAfterSuspend > entriesBeforeSuspend, "Resumed logging after suspend/resume.");
        }
Ejemplo n.º 3
0
        public string GetValue(ITorrent torrent, ParameterSource source)
        {
            switch (source)
            {
                case ParameterSource.Label:
                    return torrent.Label;
                case ParameterSource.Name:
                    return torrent.Name;
            }

            return string.Empty;
        }
Ejemplo n.º 4
0
        public void BasicLoggerDependencyConversions()
        {
            MockEcuStream stream = MockEcuStream.CreateInstance();

            this.logger = SsmBasicLogger.GetInstance(Environment.CurrentDirectory, stream);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            LogProfile baseParameters = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                if (parameter.Id == "P201")
                {
                    baseParameters.Add(parameter, parameter.Conversions[0]);
                }

                if (parameter.Id == "P202")
                {
                    baseParameters.Add(parameter, parameter.Conversions[0]);
                    break;
                }
            }

            this.logger.SetProfile(baseParameters, database);

            LogEventArgs args = this.logger.GetOneRow();

            Utility.AssertColumnParameterId(args, 0, "P201");
            Utility.AssertColumnParameterId(args, 1, "P202");
            Utility.AssertColumnParameterId(args, 2, "P8");
            Utility.AssertColumnParameterId(args, 3, "P21");
            Utility.AssertColumnParameterId(args, 4, "P7");
            Utility.AssertColumnParameterId(args, 5, "P24");

            Assert.AreEqual(6, args.Row.Columns.Count);

            List <int> addresses = this.logger.Addresses;

            Assert.AreEqual(5, addresses.Count);
            int[] expected = new int[] { 14, 15, 32, 13, 35 };
            Utility.CompareArrays("Address arrays", expected, addresses.ToArray());

            // Values from observation...
            Assert.AreEqual("2.08", args.Row.Columns[0].ValueAsString);
            Assert.AreEqual("1.02", args.Row.Columns[1].ValueAsString);
        }
Ejemplo n.º 5
0
        public void UpdateParameter(string parameterName, string value, ParameterSource source)
        {
            if (!_isLoaded)
            {
                throw new ProjectNotInitializedException();
            }

            if (Parameters.ContainsKey(parameterName))
            {
                Parameters[parameterName].SetValue(value, source);
            }
        }
Ejemplo n.º 6
0
 public MockParameter(
     ParameterSource source,
     string id,
     string name,
     IEnumerable <Parameter> dependencies)
     : base(
         source,
         id,
         name,
         new Conversion[] { mockConversion },
         dependencies)
 {
 }
Ejemplo n.º 7
0
        public string GetValue(ITorrent torrent, ParameterSource source)
        {
            switch (source)
            {
            case ParameterSource.Label:
                return(torrent.Label);

            case ParameterSource.Name:
                return(torrent.Name);
            }

            return(string.Empty);
        }
Ejemplo n.º 8
0
        public void BasicLoggerConnect()
        {
            MockEcuStream    mock   = MockEcuStream.CreateInstance();
            FragmentedStream stream = FragmentedStream.GetInstance(mock);

            this.logger = SsmBasicLogger.GetInstance(Environment.CurrentDirectory, stream);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            Assert.AreEqual("2F12785206", this.logger.EcuIdentifier, "EcuIdentifier");
            Assert.IsNotNull(source);
            Assert.IsNotNull(source.Parameters);
        }
Ejemplo n.º 9
0
        public void PlxParameters()
        {
            ParameterDatabase db        = ParameterDatabase.GetInstance();
            ParameterSource   plxSource = PlxParameterSource.GetInstance();

            db.Add(plxSource);

            Parameter   wb = db.Parameters[0];
            PlxSensorId id = new PlxSensorId(PlxSensorType.WidebandAfr, 0);

            Assert.AreEqual(id, ((PlxParameter)wb).SensorId);

            Parameter egt = db.Parameters[1];

            id = new PlxSensorId(PlxSensorType.ExhaustGasTemperature, 0);
            Assert.AreEqual(id, ((PlxParameter)egt).SensorId);
        }
Ejemplo n.º 10
0
        public static IEnumerable <Parameter> GetParameters(this Element element, ParameterSource parameterSource)
        {
            switch (parameterSource)
            {
            case ParameterSource.Any:
                return(Enum.GetValues(typeof(BuiltInParameter)).
                       Cast <BuiltInParameter>().
                       Select
                       (
                           x =>
                {
                    try { return element.get_Parameter(x); }
                    catch (Autodesk.Revit.Exceptions.InternalException) { return null; }
                }
                       ).
                       Where(x => x is object).
                       Union(element.Parameters.Cast <Parameter>()).
                       GroupBy(x => x.Id).
                       Select(x => x.First()));

            case ParameterSource.BuiltIn:
                return(Enum.GetValues(typeof(BuiltInParameter)).
                       Cast <BuiltInParameter>().
                       GroupBy(x => x).
                       Select(x => x.First()).
                       Select
                       (
                           x =>
                {
                    try { return element.get_Parameter(x); }
                    catch (Autodesk.Revit.Exceptions.InternalException) { return null; }
                }
                       ).
                       Where(x => x is object));

            case ParameterSource.Project:
                return(element.Parameters.Cast <Parameter>().
                       Where(p => !p.IsShared));

            case ParameterSource.Shared:
                return(element.Parameters.Cast <Parameter>().
                       Where(p => p.IsShared));
            }

            return(Enumerable.Empty <Parameter>());
        }
Ejemplo n.º 11
0
 private void Fill_GridRuleParameters_RuleParameters(decimal ruleGroupID, decimal ruleID, decimal ruleDateRangeID)
 {
     string[] retMessage = new string[4];
     try
     {
         this.InitializeCulture();
         BRuleParameter         RuleParameterBusiness = new BRuleParameter(ruleID, ruleGroupID);
         ParameterSource        parameterSource       = new ParameterSource();
         List <ParameterSource> ParametersSourceList  = new List <ParameterSource>();
         if (ruleDateRangeID == -1)
         {
             IList <RuleTemplateParameter> ruleParametersTemplateList = RuleParameterBusiness.GetTemplateParameters();
             foreach (RuleTemplateParameter ruleTemplateParameter in ruleParametersTemplateList)
             {
                 parameterSource = this.InsertParameters_RuleParameters(ruleTemplateParameter.ID, ruleTemplateParameter.Name, ruleTemplateParameter.Title, ruleTemplateParameter.Value, (RuleParamType)Enum.ToObject(typeof(RuleParamType), ruleTemplateParameter.Type), ruleTemplateParameter.ContinueOnTomorrow);
                 ParametersSourceList.Add(parameterSource);
             }
         }
         else
         {
             IList <RuleParameter> ruleParametersList = RuleParameterBusiness.GetRuleParameters(ruleDateRangeID);
             foreach (RuleParameter ruleParameter in ruleParametersList)
             {
                 parameterSource = this.InsertParameters_RuleParameters(ruleParameter.ID, ruleParameter.Name, ruleParameter.Title, ruleParameter.Value, (RuleParamType)Enum.ToObject(typeof(RuleParamType), ruleParameter.Type), ruleParameter.ContinueOnTomorrow);
                 ParametersSourceList.Add(parameterSource);
             }
         }
         this.GridRuleParameters_RuleParameters.DataSource = ParametersSourceList;
         this.GridRuleParameters_RuleParameters.DataBind();
     }
     catch (UIValidationExceptions ex)
     {
         retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
         this.ErrorHiddenField_RuleDateRanges_RuleParameters.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
     }
     catch (UIBaseException ex)
     {
         retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
         this.ErrorHiddenField_RuleDateRanges_RuleParameters.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
     }
     catch (Exception ex)
     {
         retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
         this.ErrorHiddenField_RuleDateRanges_RuleParameters.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
     }
 }
Ejemplo n.º 12
0
        public void LoggerConnect()
        {
            MockEcuStream mock = MockEcuStream.CreateInstance();

            this.logger = SsmLogger.GetInstance(Environment.CurrentDirectory, MockEcuStream.PortName);
            IAsyncResult result = logger.BeginConnect(ConnectCallback, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource   source   = logger.EndConnect(result);
            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            Assert.AreEqual("2F12785206", this.logger.EcuIdentifier, "EcuIdentifier");
            Assert.IsNotNull(database);
            Assert.IsNotNull(database.Parameters);
            Assert.AreEqual(database.Parameters.Count, 178);
        }
Ejemplo n.º 13
0
        public void ManualLoggingTest(Action <ParameterDatabase> callback)
        {
            MockEcuStream    stream     = MockEcuStream.CreateInstance();
            FragmentedStream fragStream = FragmentedStream.GetInstance(stream);

            this.logger = SsmBasicLogger.GetInstance(Environment.CurrentDirectory, fragStream);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            LogProfile Profile = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                Profile.Add(parameter, parameter.Conversions[0]);
                if (Profile.Columns.Count > 3)
                {
                    break;
                }
            }

            this.logStartCalls = 0;
            this.logEntryCalls = 0;
            this.logEndCalls   = 0;
            this.logErrorCalls = 0;

            this.logger.SetProfile(Profile, database);
            this.logger.LogStart += this.LogStart;
            this.logger.LogEntry += this.LogEntry;
            this.logger.LogStop  += this.LogStop;
            this.logger.LogError += this.LogError;

            this.logger.StartLogging();
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.25));
            callback(database);
            this.logger.BeginStopLogging(NoOp, null);
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.1));
        }
Ejemplo n.º 14
0
        private void BuildParameterMap()
        {
            var methodParams   = this._methodInfo.GetParameters();
            var alreadyHasBody = false;

            foreach (var methodParameter in methodParams)
            {
                if (methodParameter.Name == Constants.GRAIN_ID || methodParameter.Name == Constants.GRAIN_ID_EXTENSION)
                {
                    continue;
                }

                var attribute = methodParameter.GetCustomAttributes()
                                .Where(attr => _parameterAttributeTypes.Contains(attr.GetType())).FirstOrDefault();

                ParameterSource source = default;

                if (attribute != null)
                {
                    if (attribute is FromBodyAttribute)
                    {
                        if (alreadyHasBody)
                        {
                            throw new InvalidOperationException("A method can only have 1 body parameter.");
                        }
                        source         = ParameterSource.Body;
                        alreadyHasBody = true;
                    }
                    else if (attribute is FromQueryAttribute)
                    {
                        source = ParameterSource.Query;
                    }
                }
                else
                {
                    source = ParameterSource.Route;
                }

                this._parameters[methodParameter.Name] = new Parameter(methodParameter.Name, methodParameter.ParameterType, source);
            }
        }
Ejemplo n.º 15
0
        private ParameterDatabase InitializeLogger()
        {
            MockEcuStream stream = MockEcuStream.CreateInstance();

            this.logger = SsmBasicLogger.GetInstance(Environment.CurrentDirectory, stream);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            Assert.AreEqual("2F12785206", this.logger.EcuIdentifier, "EcuIdentifier");
            Assert.IsNotNull(source);
            Assert.AreEqual(178, source.Parameters.Count);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);
            Assert.AreEqual(178, database.Parameters.Count);

            return(database);
        }
Ejemplo n.º 16
0
        public void LoggerUserData()
        {
            SsmLogger    logger = SsmLogger.GetInstance(Environment.CurrentDirectory, MockEcuStream.PortName);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            LogProfile profile = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                profile.Add(parameter, parameter.Conversions[0]);
                if (profile.Columns.Count == 8)
                {
                    break;
                }
            }
            string userData = "UserData";

            profile.UserData = userData;
            logger.SetProfile(profile, database);
            logger.LogStart += this.LoggerUserDataLogStart;
            logger.LogEntry += this.LoggerUserDataLogEntry;
            logger.LogStop  += this.LoggerUserDataLogStop;
            logger.StartLogging();
            System.Threading.Thread.Sleep(500);
            IAsyncResult stopResult = logger.BeginStopLogging(null, null);

            stopResult.AsyncWaitHandle.WaitOne();
            logger.EndStopLogging(stopResult);

            Assert.AreSame(userData, userDataFromLogStart);
            Assert.AreSame(userData, userDataFromLogEntry);
            Assert.AreSame(userData, userDataFromLogStop);
        }
Ejemplo n.º 17
0
        public void BasicLoggerAddresses()
        {
            MockEcuStream  stream = MockEcuStream.CreateInstance();
            SsmBasicLogger logger = SsmBasicLogger.GetInstance(Environment.CurrentDirectory, stream);
            IAsyncResult   result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            LogProfile profile = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                profile.Add(parameter, parameter.Conversions[0]);
                if (profile.Columns.Count == 8)
                {
                    break;
                }
            }

            logger.SetProfile(profile, database);
            IList <int> actual = logger.Addresses;

            // Note that parameters get re-ordered alphabetically
            IList <int> expected = new int[]
            {
                // 9, 10, 8, 14, 15, 17, 18, 13, 16,
                8, 9, 10, 13, 14, 15, 16, 17, 18,
            };

            Assert.AreEqual(expected.Count, actual.Count, "Addresses.Length");
            for (int i = 0; i < expected.Count; i++)
            {
                Assert.AreEqual(expected[i], actual[i], "Addresses[" + i + "]");
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Constructor
        /// </summary>
        private SawMill(
            string configurationDirectory,
            string ssmPortName,
            string plxPortName,
            IList <SawMillScreen> screens,
            Update update)
        {
            this.update   = update;
            this.screens  = screens;
            this.database = ParameterDatabase.GetInstance();

            this.CreateLogger(configurationDirectory, ssmPortName);

            if (!string.IsNullOrEmpty(plxPortName))
            {
                ExternalSensors externalSensors = ExternalSensors.GetInstance();
                externalSensors.SetPlxSerialPort(plxPortName);

                ParameterSource plxParameters = PlxParameterSource.GetInstance();
                this.database.Add(plxParameters);
            }
        }
        private static string MapToSwaggerParameterLocation(ParameterSource swaggerSource)
        {
            switch (swaggerSource)
            {
            case ParameterSource.Query:
                return("query");

            case ParameterSource.Header:
                return("header");

            case ParameterSource.Path:
                return("path");

            case ParameterSource.FormData:
                return("formData");

            case ParameterSource.Body:
                return("body");

            default:
                throw new ArgumentOutOfRangeException(nameof(swaggerSource), swaggerSource, null);
            }
        }
Ejemplo n.º 20
0
        public void BasicLoggerProfile()
        {
            MockEcuStream stream = MockEcuStream.CreateInstance();

            this.logger = SsmBasicLogger.GetInstance(Environment.CurrentDirectory, stream);
            IAsyncResult result = logger.BeginConnect(null, null);

            result.AsyncWaitHandle.WaitOne();
            ParameterSource source = logger.EndConnect(result);

            ParameterDatabase database = ParameterDatabase.GetInstance();

            database.Add(source);

            LogProfile expectedProfile = LogProfile.CreateInstance();

            foreach (SsmParameter parameter in database.Parameters)
            {
                expectedProfile.Add(parameter, parameter.Conversions[0]);
                if (expectedProfile.Columns.Count > 3)
                {
                    break;
                }
            }
            logger.SetProfile(expectedProfile, database);
            LogProfile actualProfile = logger.CurrentProfile;

            Assert.AreEqual(expectedProfile.Columns.Count, actualProfile.Columns.Count, "Actual count and expected count");
            foreach (LogColumn expectedColumn in expectedProfile.Columns)
            {
                Assert.IsTrue(actualProfile.Contains(expectedColumn.Parameter), "Actual expected parameter set is missing something");
            }
            foreach (LogColumn actualColumn in actualProfile.Columns)
            {
                Assert.IsTrue(expectedProfile.Contains(actualColumn.Parameter), "Actual expected parameter set contains something extra");
            }
        }
Ejemplo n.º 21
0
        public static string GetParameter(this ActionContext actionContext, string name, ParameterSource source = ParameterSource.Route)
        {
            if (source == ParameterSource.Route)
            {
                return(actionContext.RouteData.Values[name] as string);
            }

            HttpRequest request = actionContext.HttpContext.Request;

            if (source == ParameterSource.Form)
            {
                if (!string.IsNullOrEmpty(request.ContentType) &&
                    (request.ContentType.StartsWith("application/x-www-form-urlencoded") ||
                     request.ContentType.StartsWith("application/form-data")))
                {
                    return(actionContext.HttpContext.Request.Form[name]);
                }
                else
                {
                    throw new InvalidOperationException("The request don't have a 'form' content type");
                }
            }


            if (source == ParameterSource.Query)
            {
                return(request.Query[name]);
            }

            if (source == ParameterSource.Header)
            {
                return(request.Headers[name]);
            }

            return(null);
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Binds the command.
 /// </summary>
 /// <param name="menuItem">The menu item.</param>
 /// <param name="command">The command.</param>
 /// <param name="parameterSource">The parameter source.</param>
 public static void BindCommand(this ToolStripMenuItem menuItem, Command command, ParameterSource parameterSource)
 {
     new ToolStripMenuItemHandler(menuItem, command, parameterSource);
 }
Ejemplo n.º 23
0
        private IParameter CreateParameter(string name, string value, bool sensitive, ParameterSource source)
        {
            var parameterMock = new Mock <IParameter>();

            parameterMock.Setup(p => p.Name).Returns(name);
            parameterMock.Setup(p => p.Sensitive).Returns(sensitive);
            parameterMock.Setup(p => p.Value).Returns(value);
            parameterMock.Setup(p => p.Source).Returns(source);
            parameterMock.Setup(p => p.SetValue(It.IsAny <string>(), It.IsAny <ParameterSource>())).Callback(
                (string newValue, ParameterSource newSource) =>
            {
                parameterMock.Setup(p => p.Value).Returns(newValue);
                parameterMock.Setup(p => p.Source).Returns(newSource);
            });

            return(parameterMock.Object);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Tracks the state.
 /// </summary>
 /// <param name="menuItem">The menu item.</param>
 /// <param name="command">The command.</param>
 /// <param name="parameterSource">The parameter source.</param>
 public static void TrackState(this ToolStripMenuItem menuItem, Command command, ParameterSource parameterSource)
 {
     new ToolStripMenuItemTracker(menuItem, command, parameterSource);
 }
 private static string MapToSwaggerParameterLocation(ParameterSource swaggerSource)
 {
     switch (swaggerSource)
     {
         case ParameterSource.Query:
             return "query";
         case ParameterSource.Header:
             return "header";
         case ParameterSource.Path:
             return "path";
         case ParameterSource.FormData:
             return "formData";
         case ParameterSource.Body:
             return "body";
         default:
             throw new ArgumentOutOfRangeException(nameof(swaggerSource), swaggerSource, null);
     }
 }
Ejemplo n.º 26
0
        private IParameter CreateParameter(string name, string value, bool sensitive, ParameterSource source)
        {
            var parameterMock = new Mock <IParameter>();

            parameterMock.Setup(p => p.Name).Returns(name);
            parameterMock.Setup(p => p.Sensitive).Returns(sensitive);
            parameterMock.Setup(p => p.Value).Returns(value);
            parameterMock.Setup(p => p.Source).Returns(source);

            return(parameterMock.Object);
        }
Ejemplo n.º 27
0
        public static IEnumerable <Autodesk.Revit.DB.Parameter> GetParameters(this Autodesk.Revit.DB.Element element, ParameterSource parameterSource)
        {
            switch (parameterSource)
            {
            case ParameterSource.Any:
                return(Enum.GetValues(typeof(BuiltInParameter)).
                       Cast <BuiltInParameter>().
                       Select(x => element.get_Parameter(x)).
                       Where(x => x?.HasValue ?? false).
                       Union(element.Parameters.Cast <Autodesk.Revit.DB.Parameter>()).
                       GroupBy(x => x.Id).
                       Select(x => x.First()));

            case ParameterSource.BuiltIn:
                return(Enum.GetValues(typeof(BuiltInParameter)).
                       Cast <BuiltInParameter>().
                       GroupBy(x => x).
                       Select(x => x.First()).
                       Select(x => element.get_Parameter(x)).
                       Where(x => x?.HasValue ?? false));

            case ParameterSource.Project:
                return(element.Parameters.Cast <Autodesk.Revit.DB.Parameter>().
                       Where(p => !p.IsShared));

            case ParameterSource.Shared:
                return(element.Parameters.Cast <Autodesk.Revit.DB.Parameter>().
                       Where(p => p.IsShared));
            }

            return(Enumerable.Empty <Autodesk.Revit.DB.Parameter>());
        }
Ejemplo n.º 28
0
 public RestServiceParameterInfo(ParameterInfo parameterInfo, ParameterSource source, string alias)
     : base(parameterInfo)
 {
     Source = source;
     Alias  = alias;
 }
 public APIParameterAttribute(ParameterSource source, string name = null)
 {
     Source = source;
     Name   = name;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Includes the given object as an generator of test method parameters.
 /// All such registered parameter sources will be asked to contribute parameters to test methods.
 /// </summary>
 public ParameterSourceExpression Add(ParameterSource parameterSource)
 {
     config.AddParameterSource(() => parameterSource);
     return(this);
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandBinding"/> class.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="parameterSource">The parameter source.</param>
 public CommandBinding(Command command, ParameterSource parameterSource)
 {
     Command                  = command;
     ParameterSource          = parameterSource;
     Command.PropertyChanged += OnCommandPropertyChanged;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Realeases the tracking.
 /// </summary>
 public virtual void RealeaseTracking()
 {
     Command.PropertyChanged -= OnCommandPropertyChanged;
     Command         = null;
     ParameterSource = null;
 }