Пример #1
0
        public Feedback AddFeedback(string userId, string itemId)
        {
            Feedback feedback;

            if (!AllowDuplicates && FeedbacksDic.ContainsKey(userId, itemId))
            {
                feedback = FeedbacksDic[userId, itemId];
                // promote a feedback to a higher level if it is already observed
                // note that this assumes that the feedback are positive
                //feedback.Level++;
                return(feedback);
            }

            User u = AddUser(userId);
            Item i = AddItem(itemId);

            feedback = new Feedback(u, i);

            Feedbacks.Add(feedback);
            u.Feedbacks.Add(feedback);
            i.Feedbacks.Add(feedback);

            FeedbacksDic.Add(userId, itemId, feedback);

            return(feedback);
        }
Пример #2
0
        public async Task ExecuteGetFeedbackCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try{
                Feedbacks.Clear();

                var feedbacks = await dataStore.GetFeedbackAsync();

                foreach (var feedback in feedbacks)
                {
                    Feedbacks.Add(feedback);
                }

                Sort();
            }catch (Exception ex) {
                Xamarin.Insights.Report(ex);
                page.DisplayAlert("Uh oh :(", "Unable to get feedback, pull to refresh when online", "OK");
            }
            finally {
                IsBusy = false;
            }
        }
Пример #3
0
        public TesiraDspMeter(string key, TesiraMeterBlockConfig config, TesiraDsp parent)
            : base(config.MeterInstanceTag, string.Empty, config.Index, 0, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            DeviceManager.AddDevice(this);

            Label   = config.Label;
            Enabled = config.Enabled;

            MeterFeedback      = new IntFeedback(Key + "-MeterFeedback", () => _currentMeter);
            SubscribedFeedback = new BoolFeedback(Key + "-SubscribedFeedback", () => IsSubscribed);

            Feedbacks.Add(MeterFeedback);
            Feedbacks.Add(SubscribedFeedback);
            Feedbacks.Add(NameFeedback);

            parent.Feedbacks.AddRange(Feedbacks);

            if (config.MeterData != null)
            {
                var data = config.MeterData;
                _meterMinimum    = data.MeterMimimum;
                _meterMaximum    = data.MeterMaxiumum;
                _defaultPollTime = data.DefaultPollTime;
            }
            else
            {
                _meterMinimum    = MeterMinimumDefault;
                _meterMaximum    = MeterMaximumDefault;
                _defaultPollTime = DefaultPollTimeDefault;
            }

            /*CrestronConsole.AddNewConsoleCommand(s => Subscribe(), "enablemeters", "", ConsoleAccessLevelEnum.AccessOperator);
             * CrestronConsole.AddNewConsoleCommand(s => UnSubscribe(), "disablemeters", "", ConsoleAccessLevelEnum.AccessOperator);*/
        }
Пример #4
0
        public Rating AddRating(string userId, string itemId, float rating)
        {
            if (rating > _maxTarget)
            {
                _maxTarget = rating;
            }

            if (rating < _minTarget)
            {
                _minTarget = rating;
            }

            User u = AddUser(userId);
            Item i = AddItem(itemId);

            var r = new Rating(u, i, rating);

            Feedbacks.Add(r);
            u.Feedbacks.Add(r);
            i.Feedbacks.Add(r);

            FeedbacksDic.Add(userId, itemId, r);

            return(r);
        }
        /// <summary>
        /// Initializes this attribute based on config values and generates subscriptions commands and adds commands to the parent's queue.
        /// </summary>
        /// <param name="config">Configuration Object</param>
        private void Initialize(TesiraRoomCombinerBlockConfig config)
        {
            if (config.Enabled)
            {
                DeviceManager.AddDevice(this);
            }

            Debug.Console(2, this, "Adding RoomCombiner '{0}'", Key);

            IsSubscribed = false;

            HasMute                     = config.HasMute;
            HasLevel                    = config.HasLevel;
            UseAbsoluteValue            = config.UseAbsoluteValue;
            Enabled                     = config.Enabled;
            Permissions                 = config.Permissions;
            IncrementAmount             = config.IncrementAmount;
            AutomaticUnmuteOnVolumeUp   = config.UnmuteOnVolChange;
            _volumeUpRepeatTimer        = new CTimer((o) => VolumeUpRepeat(), Timeout.Infinite);
            _volumeDownRepeatTimer      = new CTimer((o) => VolumeDownRepeat(), Timeout.Infinite);
            _volumeUpRepeatDelayTimer   = new CTimer((o) => VolumeUpRepeatDelay(), Timeout.Infinite);
            _volumeDownRepeatDelayTimer = new CTimer((o) => VolumeDownRepeatDelay(), Timeout.Infinite);

            _pollTimer = new CTimer((o) => DoPoll(), Timeout.Infinite);


            if (HasMute && HasLevel)
            {
                ControlType = 0;
            }
            else if (!HasMute && HasLevel)
            {
                ControlType = 1;
            }

            else if (HasMute && !HasLevel)
            {
                ControlType = 2;
            }

            MuteFeedback    = new BoolFeedback(Key + "-MuteFeedback", () => OutIsMuted);
            VisibleFeedback = new BoolFeedback(Key + "-VisibleFeedback", () => Enabled);

            RoomGroupFeedback   = new IntFeedback(Key + "-RoomGroupFeedback", () => RoomGroup);
            VolumeLevelFeedback = new IntFeedback(Key + "-LevelFeedback", () => OutVolumeLevel);
            ControlTypeFeedback = new IntFeedback(Key + "-ControlTypeFeedback", () => ControlType);
            PermissionsFeedback = new IntFeedback(Key + "-PermissionsFeedback", () => Permissions);

            Feedbacks.Add(MuteFeedback);
            Feedbacks.Add(VolumeLevelFeedback);
            Feedbacks.Add(NameFeedback);
            Feedbacks.Add(VisibleFeedback);
            Feedbacks.Add(ControlTypeFeedback);
            Feedbacks.Add(PermissionsFeedback);

            Parent.Feedbacks.AddRange(Feedbacks);
        }
Пример #6
0
        public TwoWayDisplayBase(string key, string name)
            : base(key, name)
        {
            CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);

            WarmupTime   = 7000;
            CooldownTime = 15000;

            Feedbacks.Add(CurrentInputFeedback);
        }
Пример #7
0
        /// <inheritdoc />
        public IFeedbackDto AddFeedback(FeedbackDto entity)
        {
            if (entity.Id == Guid.Empty)
            {
                entity.Id = CreateSequentialGuid();
            }

            Feedbacks.Add(entity);
            return(entity);
        }
Пример #8
0
 public ActionResult FeedbackPage(Feedback feedback)
 {
     ViewBag.Title = "Залишити відгук";
     if (ModelState.IsValid)
     {
         Feedbacks db = new Feedbacks();
         feedback.Id = db.GetLastId() + 1;
         db.Add(feedback);
         return(RedirectToAction("Index"));
     }
     return(View());
 }
        /// <summary>
        /// Constructor for Tesira DSP Matrix Mixer Component
        /// </summary>
        /// <param name="key">Unique Key for Component</param>
        /// <param name="config">Config Object for Component</param>
        /// <param name="parent">Parent object of Component</param>
        public TesiraDspCrosspointState(string key, TesiraCrosspointStateBlockConfig config, TesiraDsp parent)
            : base(config.MatrixInstanceTag, string.Empty, config.Index1, config.Index2, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            Label   = config.Label;
            Enabled = config.Enabled;

            CrosspointStateFeedback = new BoolFeedback(Key + "-CrosspointStateFeedback", () => _state);

            Feedbacks.Add(CrosspointStateFeedback);
            Feedbacks.Add(NameFeedback);
            parent.Feedbacks.AddRange(Feedbacks);
        }
Пример #10
0
 /// <summary>
 /// Adds feedback(s) to the list
 /// </summary>
 /// <param name="newFbs"></param>
 public void AddToFeedbackList(params Feedback[] newFbs)
 {
     foreach (var f in newFbs)
     {
         if (f != null)
         {
             if (!Feedbacks.Contains(f))
             {
                 Feedbacks.Add(f);
             }
         }
     }
 }
Пример #11
0
        /// <summary>
        /// Constructor for StateControl Component
        /// </summary>
        /// <param name="key">Unique Key for Component</param>
        /// <param name="config">Config Object for Component</param>
        /// <param name="parent">Component Parent Object</param>
        public TesiraDspStateControl(string key, TesiraStateControlBlockConfig config, TesiraDsp parent)
            : base(config.StateInstanceTag, String.Empty, config.Index, 0, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            Debug.Console(2, this, "New State Instance Tag = {0}", config.StateInstanceTag);
            Debug.Console(2, this, "Starting State {0} Initialize", key);

            StateFeedback = new BoolFeedback(Key + "-StateFeedback", () => _state);

            Feedbacks.Add(StateFeedback);
            Feedbacks.Add(NameFeedback);
            parent.Feedbacks.AddRange(Feedbacks);

            Initialize(config);
        }
Пример #12
0
        /// <summary>
        /// Constructor for Tesira Dsp Switcher Component
        /// </summary>
        /// <param name="key">Unique Key</param>
        /// <param name="config">Sqitcher Config Object</param>
        /// <param name="parent">Parent Object</param>
        public TesiraDspSwitcher(string key, TesiraSwitcherControlBlockConfig config, TesiraDsp parent)
            : base(config.SwitcherInstanceTag, String.Empty, config.Index1, 0, parent, string.Format(KeyFormatter, parent.Key, key), config.Label, config.BridgeIndex)
        {
            SourceIndexFeedback = new IntFeedback(Key + "-SourceIndexFeedback", () => SourceIndex);

            InputPorts  = new RoutingPortCollection <RoutingInputPort>();
            OutputPorts = new RoutingPortCollection <RoutingOutputPort>();

            Feedbacks.Add(SourceIndexFeedback);
            Feedbacks.Add(NameFeedback);

            parent.Feedbacks.AddRange(Feedbacks);

            Initialize(config);
        }
Пример #13
0
        public ActionResult MailSuccess(string Id)
        {
            ViewBag.Title = "Відправлено";
            var body = new StringBuilder();

            body.AppendFormat("Посмотри пожалуйста университет с id: {0}", Id);
            Feedback feedback = new Feedback();

            feedback.Mail = "*****@*****.**";
            feedback.Name = "Admin";
            feedback.Text = body.ToString();
            Feedbacks db = new Feedbacks();

            feedback.Id = db.GetLastId() + 1;
            db.Add(feedback);
            return(View());
        }
Пример #14
0
        /// <summary>
        /// CCDDisplay Plugin device constructor for ISerialComport transport
        /// </summary>
        /// <param name="key"></param>
        /// <param name="name"></param>
        /// <param name="config"></param>
        /// <param name="display">Loaded and initialized instance of CCD Display driver instance</param>
        public RVCDisplayDevice(string key, string name, RVCDisplayConfig config, RoomViewConnectedDisplay display)
            : base(key, name)
        {
            Debug.Console(0, this, "Constructing new {0} instance", name);

            _config  = config;
            _display = display;

            StatusFeedback = new IntFeedback(() => (int)CommunicationMonitor.Status);
            Feedbacks.Add(StatusFeedback);

            VolumeLevelFeedback = new IntFeedback(() => { return((int)_display.VolumeFeedback.UShortValue); });
            MuteFeedback        = new BoolFeedback(() => _display.MuteOnFeedback.BoolValue);
            Feedbacks.Add(VolumeLevelFeedback);
            Feedbacks.Add(MuteFeedback);

            CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, _display, 12000, 30000);

            for (uint i = 1; i <= _display.SourceSelectFeedbackSigs.Count; i++)
            {
                string sourceName = "input" + i.ToString();
                /// CompactFramework fix for inline Actions and using iterator variables
                uint             sourceIndex = i;
                RoutingInputPort inputPort   = new RoutingInputPort(sourceName, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(() => _display.SourceSelectSigs[sourceIndex].BoolValue = true), this)
                {
                    FeedbackMatchObject = sourceIndex
                };
                _display.SourceSelectSigs[sourceIndex].UserObject = inputPort;
                InputPorts.Add(inputPort);
            }

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("Driver Information:");
                sb.AppendFormat("\tDevice ID:        {0}\r\n", _display.DeviceIdStringFeedback.StringValue);
                sb.AppendFormat("\tFirmware:         {0}\r\n", _display.FirmwareVersionFeedback.StringValue);
                sb.AppendFormat("\tName:             {0}\r\n", _display.ProjectorNameFeedback.StringValue);
                sb.AppendFormat("\tDescription:      {0}\r\n", _display.Description);
                sb.AppendFormat("\tStatus:           {0}\r\n", _display.StatusMessageFeedback.StringValue);
                sb.AppendFormat("\tLamp:             {0}\r\n", _display.LampHoursFeedback.UShortValue);
                sb.AppendFormat("\tLamp (text):      {0}\r\n", _display.LampHoursTextFeedback.StringValue);

                CrestronConsole.ConsoleCommandResponse("{0}", sb.ToString());
            },
                                                 Key + "INFO", "Print Driver Info", ConsoleAccessLevelEnum.AccessOperator);

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("State:");
                sb.AppendFormat("\tName:             {0}\r\n", _display.Name);
                sb.AppendFormat("\tID:               {0}\r\n", _display.ID);
                sb.AppendFormat("\tOnline:           {0}\r\n", _display.IsOnline?"Online":"Offline");
                sb.AppendFormat("\tPower:            {0}\r\n", _display.PowerOnFeedback.BoolValue?"ON":"OFF");
                sb.AppendFormat("\tCooling:          {0}\r\n", _display.CoolingDownFeedback.BoolValue ? "ON" : "OFF");
                sb.AppendFormat("\tWarming:          {0}\r\n", _display.WarmingUpFeedback.BoolValue ? "ON" : "OFF");
                sb.AppendFormat("\tMute:             {0}\r\n", _display.MuteOnFeedback.BoolValue ? "ON" : "OFF");
                sb.AppendFormat("\tVolume:           {0}\r\n", _display.VolumeFeedback.UShortValue);
                sb.AppendFormat("\tLamp:             {0}\r\n", _display.LampHoursFeedback.UShortValue);

                CrestronConsole.ConsoleCommandResponse("{0}", sb.ToString());
            },
                                                 Key + "STATE", "Print display state", ConsoleAccessLevelEnum.AccessOperator);

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Current Input:  {0}\r\n", _display.CurrentSourceFeedback.StringValue);
                sb.AppendFormat("Inputs:\r\n");
                for (uint i = 1; i <= _display.SourceSelectFeedbackSigs.Count; i++)
                {
                    string sourceName = _display.SourceNameTextFeedbackSigs[i].StringValue;
                    if (String.IsNullOrEmpty(sourceName) || String.IsNullOrEmpty(sourceName.Trim()))
                    {
                        break;
                    }
                    sb.AppendFormat("\t{0}: {1}\r\n", sourceName, _display.SourceSelectFeedbackSigs[i].BoolValue ? "ON" : "");
                }

                CrestronConsole.ConsoleCommandResponse(sb.ToString());
            },
                                                 Key + "INPUTS", "Display Driver Inputs", ConsoleAccessLevelEnum.AccessOperator);

            CrestronConsole.AddNewConsoleCommand((s) =>
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("Input Ports:\r\n");
                foreach (var inputPort in InputPorts)
                {
                    //uint sourceSelectIndex = _display.SourceSelectSigs.FirstOrDefault<BoolInputSig>(sig => sig.UserObject == inputPort).Number;
                    uint sourceSelectIndex = 0;
                    for (uint i = 1; i <= _display.SourceSelectSigs.Count; i++)
                    {
                        if (_display.SourceSelectSigs[i].UserObject == inputPort)
                        {
                            sourceSelectIndex = i;
                            break;
                        }
                    }
                    sb.AppendFormat("\t{0}: {1}\r\n", inputPort.Key, _display.SourceNameTextFeedbackSigs[sourceSelectIndex].StringValue);
                }

                CrestronConsole.ConsoleCommandResponse(sb.ToString());
            },
                                                 Key + "ROUTINGPORTS", "Display Driver Routing Ports", ConsoleAccessLevelEnum.AccessOperator);
        }
Пример #15
0
        private void Initialize(TesiraFaderControlBlockConfig config)
        {
            if (config.Enabled)
            {
                DeviceManager.AddDevice(this);
            }

            _type = config.IsMic ? ePdtLevelTypes.Microphone : ePdtLevelTypes.Speaker;

            Debug.Console(2, this, "Adding LevelControl '{0}'", Key);

            IsSubscribed = false;

            HasMute                     = config.HasMute;
            HasLevel                    = config.HasLevel;
            UseAbsoluteValue            = config.UseAbsoluteValue;
            Enabled                     = config.Enabled;
            Permissions                 = config.Permissions;
            IncrementAmount             = config.IncrementAmount;
            AutomaticUnmuteOnVolumeUp   = config.UnmuteOnVolChange;
            _volumeUpRepeatTimer        = new CTimer(VolumeUpRepeat, Timeout.Infinite);
            _volumeDownRepeatTimer      = new CTimer(VolumeDownRepeat, Timeout.Infinite);
            _volumeUpRepeatDelayTimer   = new CTimer(VolumeUpRepeatDelay, Timeout.Infinite);
            _volumeDownRepeatDelayTimer = new CTimer(VolumeDownRepeatDelay, Timeout.Infinite);



            if (HasMute && HasLevel)
            {
                ControlType = 0;
                Debug.Console(2, this, "{0} has BOTH Mute and Level", Key);
            }
            else if (!HasMute && HasLevel)
            {
                ControlType = 1;
                Debug.Console(2, this, "{0} has Level ONLY", Key);
            }

            else if (HasMute && !HasLevel)
            {
                Debug.Console(2, this, "{0} has MUTE ONLY", Key);
                ControlType = 2;
            }

            MuteFeedback    = new BoolFeedback(Key + "-MuteFeedback", () => IsMuted);
            VisibleFeedback = new BoolFeedback(Key + "-VisibleFeedback", () => Enabled);

            VolumeLevelFeedback = new IntFeedback(Key + "-LevelFeedback", () => VolumeLevel);
            TypeFeedback        = new IntFeedback(Key + "-TypeFeedback", () => (ushort)_type);
            ControlTypeFeedback = new IntFeedback(Key + "-ControlTypeFeedback", () => ControlType);
            PermissionsFeedback = new IntFeedback(Key + "-PermissionsFeedback", () => Permissions);

            Feedbacks.Add(MuteFeedback);
            Feedbacks.Add(VolumeLevelFeedback);
            Feedbacks.Add(NameFeedback);
            Feedbacks.Add(VisibleFeedback);
            Feedbacks.Add(TypeFeedback);
            Feedbacks.Add(ControlTypeFeedback);
            Feedbacks.Add(PermissionsFeedback);

            Parent.Feedbacks.AddRange(Feedbacks);
        }