예제 #1
0
        public bool SelectProfile(ProfileMeta info)
        {
            lock (lockobj) {
                using (MyStopWatch.Measure()) {
                    try {
                        var p = Profile.Load(info.Location);

                        UnregisterChangedEventHandlers();
                        if (ActiveProfile != null)
                        {
                            ActiveProfile.Dispose();
                            Profiles.Where(x => x.Id == ActiveProfile.Id).First().IsActive = false;
                        }

                        ActiveProfile = p;
                        info.IsActive = true;

                        System.Threading.Thread.CurrentThread.CurrentUICulture = ActiveProfile.ApplicationSettings.Language;
                        System.Threading.Thread.CurrentThread.CurrentCulture   = ActiveProfile.ApplicationSettings.Language;
                        Locale.Loc.Instance.ReloadLocale(ActiveProfile.ApplicationSettings.Culture);

                        LocaleChanged?.Invoke(this, null);
                        ProfileChanged?.Invoke(this, null);
                        LocationChanged?.Invoke(this, null);
                        RegisterChangedEventHandlers();
                    } catch (Exception ex) {
                        Logger.Debug(ex.Message + Environment.NewLine + ex.StackTrace);
                        return(false);
                    }
                    return(true);
                }
            }
        }
예제 #2
0
        public Task <bool> RenameProfileAsync(ProfileItem profileItem, string profileName)
        {
            var targetProfile = _sourceProfiles.FirstOrDefault(x => x.Id == profileItem.Id);

            if (targetProfile == null)
            {
                return(Task.FromResult(false));
            }

            var renamedProfile = new ProfileItem(
                name: profileName,
                interfaceId: targetProfile.InterfaceId,
                interfaceName: targetProfile.InterfaceName,
                interfaceDescription: targetProfile.InterfaceDescription,
                authentication: targetProfile.Authentication,
                encryption: targetProfile.Encryption,
                isAutoConnectEnabled: targetProfile.IsAutoConnectEnabled,
                isAutoSwitchEnabled: targetProfile.IsAutoSwitchEnabled,
                position: targetProfile.Position,
                isRadioOn: targetProfile.IsRadioOn,
                isConnected: targetProfile.IsConnected,
                signal: targetProfile.Signal,
                band: targetProfile.Band,
                channel: targetProfile.Channel);

            _sourceProfiles.Remove(targetProfile);
            _sourceProfiles.Add(renamedProfile);

            deferTask = DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));
            return(Task.FromResult(true));
        }
예제 #3
0
        public Task <bool> SetProfilePositionAsync(ProfileItem profileItem, int position)
        {
            var targetProfiles = _sourceProfiles
                                 .Where(x => x.InterfaceId == profileItem.InterfaceId)
                                 .OrderBy(x => x.Position)
                                 .ToList();

            if ((targetProfiles.Count == 0) || (targetProfiles.Count - 1 < position))
            {
                return(Task.FromResult(false));
            }

            var targetProfile = targetProfiles.FirstOrDefault(x => x.Id == profileItem.Id);

            if (targetProfile == null)
            {
                return(Task.FromResult(false));
            }

            if (targetProfile.Position == position)
            {
                return(Task.FromResult(false));
            }

            targetProfiles.Remove(targetProfile);
            targetProfiles.Insert(position, targetProfile);

            int index = 0;

            targetProfiles.ForEach(x => x.Position = index++);

            deferTask = DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));
            return(Task.FromResult(true));
        }
예제 #4
0
        private void OnNotificationReceived(object sender, WLAN_NOTIFICATION_DATA e)
        {
            Debug.WriteLine($"NotificationReceived: {(WLAN_NOTIFICATION_ACM)e.NotificationCode}");

            switch ((WLAN_NOTIFICATION_ACM)e.NotificationCode)
            {
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_scan_list_refresh:
                NetworkRefreshed?.Invoke(this, EventArgs.Empty);
                break;

            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_network_available:
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_network_not_available:
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_start:
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_end:
                AvailabilityChanged?.Invoke(this, EventArgs.Empty);
                break;

            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_interface_arrival:
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_interface_removal:
                InterfaceChanged?.Invoke(this, EventArgs.Empty);
                break;

            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_connection_complete:
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_disconnected:
                ConnectionChanged?.Invoke(this, EventArgs.Empty);
                break;

            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_profile_change:
            case WLAN_NOTIFICATION_ACM.wlan_notification_acm_profile_name_change:
                ProfileChanged?.Invoke(this, EventArgs.Empty);
                break;
            }
        }
예제 #5
0
        public void ScheduleFuction(object sender, byte key)
        {
            if (key == 9)
            {
                ProfileChangeFlag = true; return;
            }

            if (ProfileChangeFlag)
            {
                if (key < 9 && key > 0)
                {
                    ProfileChangeFlag = false;
                    ProfileChanged?.Invoke(this, key - 1);
                }
            }
            else
            {
                if (key < 9 && key > 0)
                {
                    handlers[key - 1].KeyUp();
                }
                else if (key > 9 && key <= 17)
                {
                    handlers[key - 9 - 1].KeyPress();
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Selects a new profile.
        /// </summary>
        /// <param name="profileName">The name of the profile to switch to.</param>
        public void SelectProfile(string profileName)
        {
            Debug.Assert(_profiles.ContainsKey(profileName), $"Selecting non existent profile {profileName}");

            CurrentProfile = _profiles[profileName];
            ProfileChanged?.Invoke(this, EventArgs.Empty);
            Save();
        }
예제 #7
0
        public Task <bool> DeleteProfileAsync(ProfileItem profileItem)
        {
            if (!_sourceProfiles.Remove(profileItem))
            {
                return(Task.FromResult(false));
            }

            deferTask = DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));
            return(Task.FromResult(true));
        }
예제 #8
0
        public async Task <bool> SetProfileOptionAsync(ProfileItem profileItem)
        {
            var item = profileItem ?? throw new ArgumentNullException(nameof(profileItem));

            if (!await Netsh.SetProfileParameterAsync(item.InterfaceName, item.Name, item.IsAutoConnectEnabled, item.IsAutoSwitchEnabled))
            {
                return(false);
            }

            await DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));

            return(true);
        }
예제 #9
0
        public async Task <bool> DeleteProfileAsync(ProfileItem profileItem)
        {
            var item = profileItem ?? throw new ArgumentNullException(nameof(profileItem));

            if (!await Netsh.DeleteProfileAsync(item.InterfaceName, item.Name))
            {
                return(false);
            }

            await DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));

            return(true);
        }
        private void OnProfileChanged(ProfileChanged e)
        {
            if (!e.Profile.Initialized)
            {
                return;
            }

            var storage = e.Profile.Get <ITargetProcessMessage>();

            foreach (ITargetProcessMessage message in storage)
            {
                _bus.SendLocalWithContext(e.Profile.Name, e.AccountName, message);
            }
            storage.Clear();
        }
예제 #11
0
        public void ResetProfile()
        {
            try
            {
                Settings = (ProfileSettings)Activator.CreateInstance(SettingsType);

                this.InitalizeScriptSettings(Settings, true);

                ProfileChanged?.Invoke(this, new EventArgs());
            }
            catch (Exception exc)
            {
                Global.logger.LogLine(string.Format("Exception Resetting Profile, Exception: {0}", exc), Logging_Level.Error);
            }
        }
예제 #12
0
        public Task <bool> SetProfileOptionAsync(ProfileItem profileItem)
        {
            var targetProfile = _sourceProfiles.FirstOrDefault(x => x.Id == profileItem.Id);

            if (targetProfile == null)
            {
                return(Task.FromResult(false));
            }

            targetProfile.IsAutoConnectEnabled = profileItem.IsAutoConnectEnabled;
            targetProfile.IsAutoSwitchEnabled  = profileItem.IsAutoSwitchEnabled;

            deferTask = DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));
            return(Task.FromResult(true));
        }
예제 #13
0
        public void SwitchToProfile(ApplicationProfile newProfileSettings)
        {
            if (newProfileSettings != null)
            {
                if (Profile != null)
                {
                    Profile.PropertyChanged -= Profile_PropertyChanged;
                }
                Profile = newProfileSettings;
                this.Settings.SelectedProfile = Path.GetFileNameWithoutExtension(Profile.ProfileFilepath);
                Profile.PropertyChanged      += Profile_PropertyChanged;

                ProfileChanged?.Invoke(this, new EventArgs());
            }
        }
예제 #14
0
        public void ResetProfile()
        {
            try
            {
                Profile.Reset();
                //Profile.PropertyChanged += Profile_PropertyChanged;

                //this.InitalizeScriptSettings(Profile, true);

                ProfileChanged?.Invoke(this, new EventArgs());
            }
            catch (Exception exc)
            {
                Global.logger.LogLine(string.Format("Exception Resetting Profile, Exception: {0}", exc), Logging_Level.Error);
            }
        }
예제 #15
0
        public async Task <bool> SetProfilePositionAsync(ProfileItem profileItem, int position)
        {
            var item = profileItem ?? throw new ArgumentNullException(nameof(profileItem));

            if (position < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(position));
            }

            if (!await Netsh.SetProfilePositionAsync(item.InterfaceName, item.Name, position))
            {
                return(false);
            }

            await DeferAsync(() => ProfileChanged?.Invoke(this, EventArgs.Empty));

            return(true);
        }
예제 #16
0
        public void Subscribe(ProfileChanged type)
        {
            ProfileChanged = type;
            _profileChangedSubject.OnNext(type);

            //invoke subscribe portfolio changed
            foreach (var instru in new[]
            {
                //InstrumentType.Forex,
                //InstrumentType.CFD,
                //InstrumentType.Crypto,
                InstrumentType.DigitalOption,
                //InstrumentType.TurboOption,
                //InstrumentType.BinaryOption,
                //InstrumentType.FxOption
            })
            {
                var requestId = Guid.NewGuid().ToString().Replace("-", string.Empty);
                SubscribePositionChanged(requestId, instru).ConfigureAwait(false);
            }
        }
예제 #17
0
        public void ResetProfile()
        {
            if (Disposed)
            {
                return;
            }

            try
            {
                Profile.Reset();
                //Profile.PropertyChanged += Profile_PropertyChanged;

                //this.InitalizeScriptSettings(Profile, true);

                ProfileChanged?.Invoke(this, new EventArgs());
            }
            catch (Exception exc)
            {
                Global.logger.Error(string.Format("Exception Resetting Profile, Exception: {0}", exc));
            }
        }
예제 #18
0
        public void SwitchToProfile(ApplicationProfile newProfileSettings)
        {
            if (Disposed)
            {
                return;
            }

            if (newProfileSettings != null && Profile != newProfileSettings)
            {
                if (Profile != null)
                {
                    this.SaveProfile();
                    Profile.PropertyChanged -= Profile_PropertyChanged;
                }

                Profile = newProfileSettings;
                this.Settings.SelectedProfile = Path.GetFileNameWithoutExtension(Profile.ProfileFilepath);
                Profile.PropertyChanged      += Profile_PropertyChanged;

                App.Current.Dispatcher.Invoke(() => ProfileChanged?.Invoke(this, new EventArgs()));
            }
        }
예제 #19
0
        public void ResetProfile()
        {
            try
            {
                Type setting_type = Settings.GetType();
                Settings = (ProfileSettings)Activator.CreateInstance(setting_type);

                foreach (string id in this.EffectScripts.Keys)
                {
                    if (!Settings.ScriptSettings.ContainsKey(id))
                    {
                        Settings.ScriptSettings.Add(id, new ScriptSettings(this.EffectScripts[id]));
                    }
                }

                ProfileChanged?.Invoke(this, new EventArgs());
            }
            catch (Exception exc)
            {
                Global.logger.LogLine(string.Format("Exception Resetting Profile, Exception: {0}", exc), Logging_Level.Error);
            }
        }
        //public event EventHandler<Geometry> CropGeometryChanged;

        public VASComponent(LiveSplitState state)
        {
            Log.Info("Establishing Video Auto Splitter, standby...");

            State = state;

            ComponentUI = new ComponentUI(this);

            CropGeometries      = new Dictionary <string, Geometry>();
            BasicSettingsState  = new Dictionary <string, bool>();
            CustomSettingsState = new Dictionary <string, dynamic>();

            Scanner = new Scanner(this);

            FSWatcher          = new FileSystemWatcher();
            FSWatcher.Changed += (sender, args) => {
                ProfileCleanup();
                ProfileChanged?.Invoke(this, GameProfile);
            };

            Scanner.NewResult += (sender, dm) => RunScript(sender, dm);
        }
예제 #21
0
        /// <summary>
        /// Update message handler
        /// </summary>
        /// <param name="eventType">Value of "event-type" in the JSON body</param>
        /// <param name="body">full JSON message body</param>
        protected void ProcessEventType(string eventType, JObject body)
        {
            StreamStatus status;

            switch (eventType)
            {
            case "SwitchScenes":
                SceneChanged?.Invoke(this, (string)body["scene-name"]);
                break;

            case "ScenesChanged":
                SceneListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "SourceOrderChanged":
                SourceOrderChanged?.Invoke(this, (string)body["scene-name"]);
                break;

            case "SceneItemAdded":
                SceneItemAdded?.Invoke(this, (string)body["scene-name"], (string)body["item-name"]);
                break;

            case "SceneItemRemoved":
                SceneItemRemoved?.Invoke(this, (string)body["scene-name"], (string)body["item-name"]);
                break;

            case "SceneItemVisibilityChanged":
                SceneItemVisibilityChanged?.Invoke(this, (string)body["scene-name"], (string)body["item-name"]);
                break;

            case "SceneCollectionChanged":
                SceneCollectionChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "SceneCollectionListChanged":
                SceneCollectionListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "SwitchTransition":
                TransitionChanged?.Invoke(this, (string)body["transition-name"]);
                break;

            case "TransitionDurationChanged":
                TransitionDurationChanged?.Invoke(this, (int)body["new-duration"]);
                break;

            case "TransitionListChanged":
                TransitionListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "TransitionBegin":
                TransitionBegin?.Invoke(this, EventArgs.Empty);
                break;

            case "ProfileChanged":
                ProfileChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "ProfileListChanged":
                ProfileListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "StreamStarting":
                StreamingStateChanged?.Invoke(this, OutputState.Starting);
                break;

            case "StreamStarted":
                StreamingStateChanged?.Invoke(this, OutputState.Started);
                break;

            case "StreamStopping":
                StreamingStateChanged?.Invoke(this, OutputState.Stopping);
                break;

            case "StreamStopped":
                StreamingStateChanged?.Invoke(this, OutputState.Stopped);
                break;

            case "RecordingStarting":
                RecordingStateChanged?.Invoke(this, OutputState.Starting);
                break;

            case "RecordingStarted":
                RecordingStateChanged?.Invoke(this, OutputState.Started);
                break;

            case "RecordingStopping":
                RecordingStateChanged?.Invoke(this, OutputState.Stopping);
                break;

            case "RecordingStopped":
                RecordingStateChanged?.Invoke(this, OutputState.Stopped);
                break;

            case "StreamStatus":
                if (StreamStatus != null)
                {
                    status = new StreamStatus(body);
                    StreamStatus(this, status);
                }
                break;

            case "PreviewSceneChanged":
                PreviewSceneChanged?.Invoke(this, (string)body["scene-name"]);
                break;

            case "StudioModeSwitched":
                StudioModeSwitched?.Invoke(this, (bool)body["new-state"]);
                break;

            case "ReplayStarting":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Starting);
                break;

            case "ReplayStarted":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Started);
                break;

            case "ReplayStopping":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Stopping);
                break;

            case "ReplayStopped":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Stopped);
                break;

            case "Exiting":
                OBSExit?.Invoke(this, EventArgs.Empty);
                break;

            case "Heartbeat":
                Heartbeat?.Invoke(this, new Heartbeat(body));
                break;

            case "SceneItemDeselected":
                SceneItemDeselected?.Invoke(this, (string)body["scene-name"], (string)body["item-name"], (string)body["item-id"]);
                break;

            case "SceneItemSelected":
                SceneItemSelected?.Invoke(this, (string)body["scene-name"], (string)body["item-name"], (string)body["item-id"]);
                break;

            case "SceneItemTransformChanged":
                SceneItemTransformChanged?.Invoke(this, new SceneItemTransformInfo(body));
                break;

            case "SourceAudioMixersChanged":
                SourceAudioMixersChanged?.Invoke(this, new AudioMixersChangedInfo(body));
                break;

            case "SourceAudioSyncOffsetChanged":
                SourceAudioSyncOffsetChanged?.Invoke(this, (string)body["sourceName"], (int)body["syncOffset"]);
                break;

            case "SourceCreated":
                SourceCreated?.Invoke(this, new SourceSettings(body));
                break;

            case "SourceDestroyed":
                SourceDestroyed?.Invoke(this, (string)body["sourceName"], (string)body["sourceType"], (string)body["sourceKind"]);
                break;

            case "SourceRenamed":
                SourceRenamed?.Invoke(this, (string)body["newName"], (string)body["previousName"]);
                break;

            case "SourceMuteStateChanged":
                SourceMuteStateChanged?.Invoke(this, (string)body["sourceName"], (bool)body["muted"]);
                break;

            case "SourceVolumeChanged":
                SourceVolumeChanged?.Invoke(this, (string)body["sourceName"], (float)body["volume"]);
                break;

            case "SourceFilterAdded":
                SourceFilterAdded?.Invoke(this, (string)body["sourceName"], (string)body["filterName"], (string)body["filterType"], (JObject)body["filterSettings"]);
                break;

            case "SourceFilterRemoved":
                SourceFilterRemoved?.Invoke(this, (string)body["sourceName"], (string)body["filterName"]);
                break;

            case "SourceFiltersReordered":
                List <FilterReorderItem> filters = new List <FilterReorderItem>();
                JsonConvert.PopulateObject(body["filters"].ToString(), filters);
                SourceFiltersReordered?.Invoke(this, (string)body["sourceName"], filters);
                break;
            }
        }
예제 #22
0
        /// <summary>
        /// Update message handler
        /// </summary>
        /// <param name="eventType">Value of "event-type" in the JSON body</param>
        /// <param name="body">full JSON message body</param>
        protected void ProcessEventType(string eventType, JObject body)
        {
            StreamStatus status;

            switch (eventType)
            {
            case "SwitchScenes":
                SceneChanged?.Invoke(this, (string)body["scene-name"]);
                break;

            case "ScenesChanged":
                SceneListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "SourceOrderChanged":
                SourceOrderChanged?.Invoke(this, (string)body["scene-name"]);
                break;

            case "SceneItemAdded":
                SceneItemAdded?.Invoke(this, (string)body["scene-name"], (string)body["item-name"]);
                break;

            case "SceneItemRemoved":
                SceneItemRemoved?.Invoke(this, (string)body["scene-name"], (string)body["item-name"]);
                break;

            case "SceneItemVisibilityChanged":
                SceneItemVisibilityChanged?.Invoke(this, (string)body["scene-name"], (string)body["item-name"], (bool)body["item-visible"]);
                break;

            case "SceneItemLockChanged":
                SceneItemLockChanged?.Invoke(this, (string)body["scene-name"], (string)body["item-name"], (int)body["item-id"], (bool)body["item-locked"]);
                break;

            case "SceneCollectionChanged":
                SceneCollectionChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "SceneCollectionListChanged":
                SceneCollectionListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "SwitchTransition":
                TransitionChanged?.Invoke(this, (string)body["transition-name"]);
                break;

            case "TransitionDurationChanged":
                TransitionDurationChanged?.Invoke(this, (int)body["new-duration"]);
                break;

            case "TransitionListChanged":
                TransitionListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "TransitionBegin":
                TransitionBegin?.Invoke(this, (string)body["name"], (string)body["type"], (int)body["duration"], (string)body["from-scene"], (string)body["to-scene"]);
                break;

            case "TransitionEnd":
                TransitionEnd?.Invoke(this, (string)body["name"], (string)body["type"], (int)body["duration"], (string)body["to-scene"]);
                break;

            case "TransitionVideoEnd":
                TransitionVideoEnd?.Invoke(this, (string)body["name"], (string)body["type"], (int)body["duration"], (string)body["from-scene"], (string)body["to-scene"]);
                break;

            case "ProfileChanged":
                ProfileChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "ProfileListChanged":
                ProfileListChanged?.Invoke(this, EventArgs.Empty);
                break;

            case "StreamStarting":
                StreamingStateChanged?.Invoke(this, OutputState.Starting);
                break;

            case "StreamStarted":
                StreamingStateChanged?.Invoke(this, OutputState.Started);
                break;

            case "StreamStopping":
                StreamingStateChanged?.Invoke(this, OutputState.Stopping);
                break;

            case "StreamStopped":
                StreamingStateChanged?.Invoke(this, OutputState.Stopped);
                break;

            case "RecordingStarting":
                RecordingStateChanged?.Invoke(this, OutputState.Starting);
                break;

            case "RecordingStarted":
                RecordingStateChanged?.Invoke(this, OutputState.Started);
                break;

            case "RecordingStopping":
                RecordingStateChanged?.Invoke(this, OutputState.Stopping);
                break;

            case "RecordingStopped":
                RecordingStateChanged?.Invoke(this, OutputState.Stopped);
                break;

            case "RecordingPaused":
                RecordingPaused?.Invoke(this, EventArgs.Empty);
                break;

            case "RecordingResumed":
                RecordingResumed?.Invoke(this, EventArgs.Empty);
                break;

            case "StreamStatus":
                if (StreamStatus != null)
                {
                    status = new StreamStatus(body);
                    StreamStatus(this, status);
                }
                break;

            case "PreviewSceneChanged":
                PreviewSceneChanged?.Invoke(this, (string)body["scene-name"]);
                break;

            case "StudioModeSwitched":
                StudioModeSwitched?.Invoke(this, (bool)body["new-state"]);
                break;

            case "ReplayStarting":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Starting);
                break;

            case "ReplayStarted":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Started);
                break;

            case "ReplayStopping":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Stopping);
                break;

            case "ReplayStopped":
                ReplayBufferStateChanged?.Invoke(this, OutputState.Stopped);
                break;

            case "Exiting":
                OBSExit?.Invoke(this, EventArgs.Empty);
                break;

            case "Heartbeat":
                Heartbeat?.Invoke(this, new Heartbeat(body));
                break;

            case "SceneItemDeselected":
                SceneItemDeselected?.Invoke(this, (string)body["scene-name"], (string)body["item-name"], (string)body["item-id"]);
                break;

            case "SceneItemSelected":
                SceneItemSelected?.Invoke(this, (string)body["scene-name"], (string)body["item-name"], (string)body["item-id"]);
                break;

            case "SceneItemTransformChanged":
                SceneItemTransformChanged?.Invoke(this, new SceneItemTransformInfo(body));
                break;

            case "SourceAudioMixersChanged":
                SourceAudioMixersChanged?.Invoke(this, new AudioMixersChangedInfo(body));
                break;

            case "SourceAudioSyncOffsetChanged":
                SourceAudioSyncOffsetChanged?.Invoke(this, (string)body["sourceName"], (int)body["syncOffset"]);
                break;

            case "SourceCreated":
                SourceCreated?.Invoke(this, new SourceSettings(body));
                break;

            case "SourceDestroyed":
                SourceDestroyed?.Invoke(this, (string)body["sourceName"], (string)body["sourceType"], (string)body["sourceKind"]);
                break;

            case "SourceRenamed":
                SourceRenamed?.Invoke(this, (string)body["newName"], (string)body["previousName"]);
                break;

            case "SourceMuteStateChanged":
                SourceMuteStateChanged?.Invoke(this, (string)body["sourceName"], (bool)body["muted"]);
                break;

            case "SourceAudioDeactivated":
                SourceAudioDeactivated?.Invoke(this, (string)body["sourceName"]);
                break;

            case "SourceAudioActivated":
                SourceAudioActivated?.Invoke(this, (string)body["sourceName"]);
                break;

            case "SourceVolumeChanged":
                SourceVolumeChanged?.Invoke(this, new SourceVolume(body));
                break;

            case "SourceFilterAdded":
                SourceFilterAdded?.Invoke(this, (string)body["sourceName"], (string)body["filterName"], (string)body["filterType"], (JObject)body["filterSettings"]);
                break;

            case "SourceFilterRemoved":
                SourceFilterRemoved?.Invoke(this, (string)body["sourceName"], (string)body["filterName"]);
                break;

            case "SourceFiltersReordered":
                if (SourceFiltersReordered != null)
                {
                    List <FilterReorderItem> filters = new List <FilterReorderItem>();
                    JsonConvert.PopulateObject(body["filters"].ToString(), filters);

                    SourceFiltersReordered?.Invoke(this, (string)body["sourceName"], filters);
                }
                break;

            case "SourceFilterVisibilityChanged":
                SourceFilterVisibilityChanged?.Invoke(this, (string)body["sourceName"], (string)body["filterName"], (bool)body["filterEnabled"]);
                break;

            case "BroadcastCustomMessage":
                BroadcastCustomMessageReceived?.Invoke(this, (string)body["realm"], (JObject)body["data"]);
                break;

            case "MediaEnded":
                MediaEnded?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaStarted":
                MediaStarted?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaPrevious":
                MediaPrevious?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaNext":
                MediaNext?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaStopped":
                MediaStopped?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaRestarted":
                MediaRestarted?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaPaused":
                MediaPaused?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "MediaPlaying":
                MediaPlaying?.Invoke(this, (string)body["sourceName"], (string)body["sourceKind"]);
                break;

            case "VirtualCamStarted":
                VirtualCameraStarted?.Invoke(this, EventArgs.Empty);
                break;

            case "VirtualCamStopped":
                VirtualCameraStopped?.Invoke(this, EventArgs.Empty);
                break;

            default:
                var message = $"Unsupported Event: {eventType}\n{body}";
                Console.WriteLine(message);
                Debug.WriteLine(message);
                break;
            }
        }
 public ProfilesPageViewModel()
 {
     Title           = Resources.ProfilesPage_Title;
     Icon            = "Profiles";
     ProfileSelected = new RelayCommand(() => ProfileChanged?.Invoke(Profile));
 }
예제 #24
0
 /// <summary>
 /// To call when a modification to the current profil properties has changed
 /// </summary>
 public void CurrentProfilUpdated()
 {
     DataAccess.UpdateEntity(UserManager.Instance.CurrentProfile);
     ProfileChanged?.Invoke();
 }
예제 #25
0
 protected override void OnCurrentProfileChanged(Profile oldProfile, Profile newProfile)
 {
     ProfileChanged?.Invoke(this, new OnProfileChangedEventArgs(newProfile));
 }
예제 #26
0
 void ProfileChangedNotification(ProfileChanged profileChanged)
 {
     Profile.CommitChanges(profileChanged.Changes);
 }