Пример #1
0
        void LiveVideoClick(ChannelLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "LiveVideoClick", RegionNames.reg_property);
            column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.liveVideo);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            StreamInfoHelper strinfo = new StreamInfoHelper();

            strinfo.streamInfo = () => {
                return(Apm.Iterate(LoadStreamInfoNVT(evarg, strinfo)));
            };
            ctx.RegisterInstance <IStreamInfoHelper>(strinfo);

            Ctxdisp = ctx;

            ctx.RegisterInstance <IVideoInfo>(evarg.videoInfo);

            string videoSourceToken = evarg.token;
            string profToken        = evarg.profile.token;

            UIdisp = LiveVideoActivity
                     .Run(ctx, profToken, videoSourceToken)
                     .Subscribe(x => {
                eventAggregator.GetEvent <VideoChangedEvent>().Publish(evarg);
            }, err => {
                dbg.Error(err);
            });
        }
Пример #2
0
        void ProfilesClick(ChannelLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "ProfilesClick", RegionNames.reg_property);
            column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.profileEditor);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            Ctxdisp = ctx;

            UIdisp = ProfileManagementActivity
                     .Run(ctx, evarg.profile == null ? null : evarg.profile.token, evarg.token)
                     .ObserveOnCurrentDispatcher()
                     .Subscribe(x => {
                if (x.IsSelect)
                {
                    var profTok = ((ProfileManagementActivityResult.Select)x).Item;
                    ProfileChangedEventArgs evargs = new ProfileChangedEventArgs(evarg.session, evarg.token, profTok);
                    eventAggregator.GetEvent <ProfileChangedPreviewEvent>().Publish(evargs);
                }
                else if (x.IsRefresh)
                {
                    ProfileChangedEventArgs evargs = new ProfileChangedEventArgs(evarg.session, evarg.token, evarg.profile.token);
                    eventAggregator.GetEvent <ProfileChangedPreviewEvent>().Publish(evargs);
                }
            }, err => {
                dbg.Error(err);
            });
        }
Пример #3
0
 void VideoChangedEvent(ChannelLinkEventArgs args)
 {
     if (args.token == videoSource.token)
     {
         //StopVideoStreaming();
         LoadFromToken(args.profile.token);
     }
 }
Пример #4
0
        void PTZClick(ChannelLinkEventArgs evarg)
        {
            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(800))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            //        eventAggregator.GetEvent<VideoStreamingClick>().Publish(evarg);
            //    });

            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(380))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            //        eventAggregator.GetEvent<LiveVideoClick>().Publish(evarg);
            //    });

            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(380))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            //        var mevarg = new MetadataEventArgs();
            //        mevarg.currentAccount = evarg.currentAccount;
            //        mevarg.profile =
            //        eventAggregator.GetEvent<MetadataClick>().Publish(evarg);
            //    });

            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(50))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "PTZClick", RegionNames.reg_property);
            column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.ptz);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            Ctxdisp = ctx;

            ctx.RegisterInstance <IVideoInfo>(evarg.videoInfo);

            PtzInfo ptzInfo = new PtzInfo()
            {
                ProfileToken = evarg.profile.token
            };

            ctx.RegisterInstance <IPtzInfo>(ptzInfo);

            UIdisp = PtzActivity
                     .Run(ctx, evarg.profile.token)
                     .Subscribe(x => {
            }, err => {
                dbg.Error(err);
            });
            //});
        }
Пример #5
0
        void UITestClick(UITestEventArgs evarg)
        {
            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(860))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            //        var args = new ChannelLinkEventArgs();
            //        args.currentAccount = evarg.currentAccount;
            //        args.profileToken = evarg.profileToken;
            //        args.session = evarg.session;
            //        args.token = evarg.token;
            //        args.videoInfo = evarg.videoInfo;
            //        eventAggregator.GetEvent<VideoStreamingClick>().Publish(args);
            //    });

            Observable
            .Interval(TimeSpan.FromMilliseconds(200))
            .ObserveOnDispatcher()
            .Subscribe(l => {
                var args            = new ChannelLinkEventArgs();
                args.currentAccount = evarg.currentAccount;
                args.profile        = evarg.profile;
                args.session        = evarg.session;
                args.token          = evarg.token;
                args.videoInfo      = evarg.videoInfo;
                eventAggregator.GetEvent <LiveVideoClick>().Publish(args);
            });

            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(180))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            //        var args = new MetadataEventArgs();
            //        args.currentAccount = evarg.currentAccount;
            //        args.profileToken = evarg.profileToken;
            //        args.session = evarg.session;
            //        args.token = evarg.token;
            //        args.videoInfo = evarg.videoInfo;
            //        eventAggregator.GetEvent<MetadataClick>().Publish(args);
            //    });

            //Observable
            //    .Interval(TimeSpan.FromMilliseconds(50))
            //    .ObserveOnDispatcher()
            //    .Subscribe(l => {
            //        var args = new ChannelLinkEventArgs();
            //        args.currentAccount = evarg.currentAccount;
            //        args.profileToken = evarg.profileToken;
            //        args.session = evarg.session;
            //        args.token = evarg.token;
            //        args.videoInfo = evarg.videoInfo;
            //        eventAggregator.GetEvent<PTZClick>().Publish(args);
            //    });
        }
Пример #6
0
        protected ChannelLinkEventArgs GetEventArg()
        {
            var evArg = new ChannelLinkEventArgs();

            evArg.currentAccount = currentAccount;
            evArg.profile        = profile;
            evArg.session        = session;
            evArg.token          = channelToken;
            evArg.videoInfo      = videoInfo;
            return(evArg);
        }
Пример #7
0
        void RulesClick(ChannelLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "RulesClick", RegionNames.reg_property);
            column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.ruleEngine);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            //TODO: Stub fix for #225 Remove this with plugin functionality
            ILastChangedModule lmodule = new LastChangedModule();

            ctx.RegisterInstance <ILastChangedModule>(lmodule);
            //

            StreamInfoHelper strinfo = new StreamInfoHelper();

            strinfo.streamInfo = () => {
                return(Apm.Iterate(LoadStreamInfoNVT(evarg, strinfo)));
            };
            ctx.RegisterInstance <IStreamInfoHelper>(strinfo);

            Ctxdisp = ctx;

            ctx.RegisterInstance <IVideoInfo>(evarg.videoInfo);
            ctx.RegisterInstance <odm.ui.activities.AnalyticsView.AnalyticType>(odm.ui.activities.AnalyticsView.AnalyticType.RULE);

            string token = null;

            if (evarg.profile.videoAnalyticsConfiguration != null)
            {
                token = evarg.profile.videoAnalyticsConfiguration.token;
            }
            UIdisp = AnalyticsActivity
                     .Run(ctx, token)
                     .Subscribe(x => {
                //TODO: handle return from activity
            }, err => {
                dbg.Error(err);
            });
        }
Пример #8
0
        void ImagingClick(ChannelLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "ImagingClick", RegionNames.reg_property);
            column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.sensorSettings);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            Ctxdisp = ctx;

            ctx.RegisterInstance <IVideoInfo>(evarg.videoInfo);

            UIdisp = ImagingSettingsActivity
                     .Run(ctx, evarg.profile.token)
                     .Subscribe(x => {
                eventAggregator.GetEvent <VideoChangedEvent>().Publish(evarg);
            }, err => {
                dbg.Error(err);
            });
        }
Пример #9
0
        void VideoStreamingClick(ChannelLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "VideoStreamingClick", RegionNames.reg_property);
            column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.videoStreaming);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            Ctxdisp = ctx;

            ctx.RegisterInstance <IVideoInfo>(evarg.videoInfo);

            UIdisp = VideoSettingsActivity
                     .Run(ctx, evarg.profile.token)
                     .Subscribe(x => {
                eventAggregator.GetEvent <VideoChangedEvent>().Publish(evarg);
            }, err => {
                dbg.Error(err);
            });
            //subscriptions.Add(evarg.session.GetScopes()
            //    .ObserveOnCurrentDispatcher()
            //    .Subscribe(scopes => {
            //        var slist = (scopes == null ? Enumerable.Empty<string>() : scopes.Select(x => x.ScopeItem)).ToList();
            //        ScopesHolder sholder = new ScopesHolder(slist.ToArray());
            //        ctx.RegisterInstance<IScopesHolder>(sholder);
            //        UIdisp = VideoSettingsActivity
            //            .Run(ctx, evarg.profileToken)
            //            .Subscribe(x => {
            //                eventAggregator.GetEvent<VideoChangedEvent>().Publish(evarg);
            //            }, err => {
            //                dbg.Error(err);
            //            });
            //    }, err => {
            //        dbg.Error(err);
            //    }));
        }
Пример #10
0
        IEnumerable <FSharpAsync <Unit> > LoadStreamInfoNVT(ChannelLinkEventArgs args, StreamInfoHelper parent)
        {
            StreamInfoArgs strInfoArgs = new StreamInfoArgs(args.session);

            strInfoArgs.encoderResolution = new Size(args.profile.videoEncoderConfiguration.resolution.width, args.profile.videoEncoderConfiguration.resolution.height);

            var strsetup = new StreamSetup()
            {
                stream    = StreamType.rtpUnicast,
                transport = new Transport()
                {
                    protocol = AppDefaults.visualSettings.Transport_Type
                }
            };

            strInfoArgs.streamSetup = strsetup;

            yield return(args.session.GetStreamUri(strsetup, args.profile.token).Select(muri => {
                strInfoArgs.streamUri = muri.uri;

                parent.args = strInfoArgs;
                return (Unit)null;
            }));

            yield return(args.session.GetVideoSourceConfiguration(args.profile.videoSourceConfiguration.token).Select(conf => {
                if (conf != null && conf.bounds != null)
                {
                    strInfoArgs.sourceResolution = new Size(conf.bounds.width, conf.bounds.height);
                }
                else
                {
                    strInfoArgs.sourceResolution = new Size(720, 576);
                }
                return (Unit)null;
            }));
        }
		IEnumerable<FSharpAsync<Unit>> LoadStreamInfoNVT(ChannelLinkEventArgs args, StreamInfoHelper parent) {
			StreamInfoArgs strInfoArgs = new StreamInfoArgs(args.session);
			strInfoArgs.encoderResolution = new Size(args.profile.videoEncoderConfiguration.resolution.width, args.profile.videoEncoderConfiguration.resolution.height);

			var strsetup = new StreamSetup() {
				stream = StreamType.rtpUnicast,
				transport = new Transport() {
					protocol = AppDefaults.visualSettings.Transport_Type
				}
			};

			strInfoArgs.streamSetup = strsetup;

			yield return args.session.GetStreamUri(strsetup, args.profile.token).Select(muri => {
				strInfoArgs.streamUri = muri.uri;

				parent.args = strInfoArgs;
				return (Unit)null;
			});

			yield return args.session.GetVideoSourceConfiguration(args.profile.videoSourceConfiguration.token).Select(conf => {
				if (conf != null && conf.bounds != null)
					strInfoArgs.sourceResolution = new Size(conf.bounds.width, conf.bounds.height);
				else {
					strInfoArgs.sourceResolution = new Size(720, 576);
				}
				return (Unit)null;
			});
		}
		void PTZClick(ChannelLinkEventArgs evarg) {

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(800))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			//        eventAggregator.GetEvent<VideoStreamingClick>().Publish(evarg);
			//    });

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(380))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			//        eventAggregator.GetEvent<LiveVideoClick>().Publish(evarg);
			//    });

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(380))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			//        var mevarg = new MetadataEventArgs();
			//        mevarg.currentAccount = evarg.currentAccount;
			//        mevarg.profile = 
			//        eventAggregator.GetEvent<MetadataClick>().Publish(evarg);
			//    });

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(50))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "PTZClick", RegionNames.reg_property);
			column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.ptz);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);
			Ctxdisp = ctx;

			ctx.RegisterInstance<IVideoInfo>(evarg.videoInfo);

			PtzInfo ptzInfo = new PtzInfo() { ProfileToken = evarg.profile.token };
			ctx.RegisterInstance<IPtzInfo>(ptzInfo);

			UIdisp = PtzActivity
				.Run(ctx, evarg.profile.token)
				.Subscribe(x => {
				}, err => {
					dbg.Error(err);
				});
			//});

		}
		void LiveVideoClick(ChannelLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "LiveVideoClick", RegionNames.reg_property);
			column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.liveVideo);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

			StreamInfoHelper strinfo = new StreamInfoHelper();
			strinfo.streamInfo = () => {
				return Apm.Iterate(LoadStreamInfoNVT(evarg, strinfo));
			};
			ctx.RegisterInstance<IStreamInfoHelper>(strinfo);

			Ctxdisp = ctx;

			ctx.RegisterInstance<IVideoInfo>(evarg.videoInfo);

			string videoSourceToken = evarg.token;
			string profToken = evarg.profile.token;

			UIdisp = LiveVideoActivity
				.Run(ctx, profToken, videoSourceToken)
				.Subscribe(x => {
					eventAggregator.GetEvent<VideoChangedEvent>().Publish(evarg);
				}, err => {
					dbg.Error(err);
				});
		}
		void RulesClick(ChannelLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "RulesClick", RegionNames.reg_property);
			column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.ruleEngine);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

			//TODO: Stub fix for #225 Remove this with plugin functionality
			ILastChangedModule lmodule = new LastChangedModule();
			ctx.RegisterInstance<ILastChangedModule>(lmodule);
			//

			StreamInfoHelper strinfo = new StreamInfoHelper();
			strinfo.streamInfo = () => {
				return Apm.Iterate(LoadStreamInfoNVT(evarg, strinfo));
			};
			ctx.RegisterInstance<IStreamInfoHelper>(strinfo);

			Ctxdisp = ctx;

			ctx.RegisterInstance<IVideoInfo>(evarg.videoInfo);
			ctx.RegisterInstance<odm.ui.activities.AnalyticsView.AnalyticType>(odm.ui.activities.AnalyticsView.AnalyticType.RULE);

			string token = null;
			if (evarg.profile.videoAnalyticsConfiguration != null)
				token = evarg.profile.videoAnalyticsConfiguration.token;
			UIdisp = AnalyticsActivity
				.Run(ctx, token)
				.Subscribe(x => {
					//TODO: handle return from activity
				}, err => {
					dbg.Error(err);
				});
		}
		void UITestClick(UITestEventArgs evarg) {

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(860))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			//        var args = new ChannelLinkEventArgs();
			//        args.currentAccount = evarg.currentAccount;
			//        args.profileToken = evarg.profileToken;
			//        args.session = evarg.session;
			//        args.token = evarg.token;
			//        args.videoInfo = evarg.videoInfo;
			//        eventAggregator.GetEvent<VideoStreamingClick>().Publish(args);
			//    });

			Observable
				.Interval(TimeSpan.FromMilliseconds(200))
				.ObserveOnDispatcher()
				.Subscribe(l => {
					var args = new ChannelLinkEventArgs();
					args.currentAccount = evarg.currentAccount;
					args.profile = evarg.profile;
					args.session = evarg.session;
					args.token = evarg.token;
					args.videoInfo = evarg.videoInfo;
					eventAggregator.GetEvent<LiveVideoClick>().Publish(args);
				});

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(180))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			//        var args = new MetadataEventArgs();
			//        args.currentAccount = evarg.currentAccount;
			//        args.profileToken = evarg.profileToken;
			//        args.session = evarg.session;
			//        args.token = evarg.token;
			//        args.videoInfo = evarg.videoInfo;
			//        eventAggregator.GetEvent<MetadataClick>().Publish(args);
			//    });

			//Observable
			//    .Interval(TimeSpan.FromMilliseconds(50))
			//    .ObserveOnDispatcher()
			//    .Subscribe(l => {
			//        var args = new ChannelLinkEventArgs();
			//        args.currentAccount = evarg.currentAccount;
			//        args.profileToken = evarg.profileToken;
			//        args.session = evarg.session;
			//        args.token = evarg.token;
			//        args.videoInfo = evarg.videoInfo;
			//        eventAggregator.GetEvent<PTZClick>().Publish(args);
			//    });

		}
		void VideoStreamingClick(ChannelLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "VideoStreamingClick", RegionNames.reg_property);
			column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.videoStreaming);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);
			Ctxdisp = ctx;

			ctx.RegisterInstance<IVideoInfo>(evarg.videoInfo);

			UIdisp = VideoSettingsActivity
						.Run(ctx, evarg.profile.token)
						.Subscribe(x => {
							eventAggregator.GetEvent<VideoChangedEvent>().Publish(evarg);
						}, err => {
							dbg.Error(err);
						});
			//subscriptions.Add(evarg.session.GetScopes()
			//    .ObserveOnCurrentDispatcher()
			//    .Subscribe(scopes => {
			//        var slist = (scopes == null ? Enumerable.Empty<string>() : scopes.Select(x => x.ScopeItem)).ToList();
			//        ScopesHolder sholder = new ScopesHolder(slist.ToArray());
			//        ctx.RegisterInstance<IScopesHolder>(sholder);
			//        UIdisp = VideoSettingsActivity
			//            .Run(ctx, evarg.profileToken)
			//            .Subscribe(x => {
			//                eventAggregator.GetEvent<VideoChangedEvent>().Publish(evarg);
			//            }, err => {
			//                dbg.Error(err);
			//            });
			//    }, err => {
			//        dbg.Error(err);
			//    }));
		}
		void ImagingClick(ChannelLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "ImagingClick", RegionNames.reg_property);
			column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.sensorSettings);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);
			Ctxdisp = ctx;

			ctx.RegisterInstance<IVideoInfo>(evarg.videoInfo);

			UIdisp = ImagingSettingsActivity
				.Run(ctx, evarg.profile.token)
				.Subscribe(x => {
					eventAggregator.GetEvent<VideoChangedEvent>().Publish(evarg);
				}, err => {
					dbg.Error(err);
				});
		}
Пример #18
0
 protected ChannelLinkEventArgs GetEventArg(){
     var evArg = new ChannelLinkEventArgs();
     evArg.currentAccount = currentAccount;
     evArg.profile = profile;
     evArg.session = session;
     evArg.token = channelToken;
     evArg.videoInfo = videoInfo;
     return evArg;
 }
		void ProfilesClick(ChannelLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "ProfilesClick", RegionNames.reg_property);
			column.CreateBinding(ContentColumn.TitleProperty, LinkButtonsStrings.instance, x => x.profileEditor);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);
			Ctxdisp = ctx;

			UIdisp = ProfileManagementActivity
					 .Run(ctx, evarg.profile == null ? null : evarg.profile.token, evarg.token)
				.ObserveOnCurrentDispatcher()
				.Subscribe(x => {
					if (x.IsSelect) {
						var profTok = ((ProfileManagementActivityResult.Select)x).Item;
						ProfileChangedEventArgs evargs = new ProfileChangedEventArgs(evarg.session, evarg.token, profTok);
						eventAggregator.GetEvent<ProfileChangedPreviewEvent>().Publish(evargs);
					} else if (x.IsRefresh) {
						ProfileChangedEventArgs evargs = new ProfileChangedEventArgs(evarg.session, evarg.token, evarg.profile.token);
						eventAggregator.GetEvent<ProfileChangedPreviewEvent>().Publish(evargs);
					}
				}, err => {
					dbg.Error(err);
				});
		}