public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr) {
			this.modulDescr = modulDescr;
			this.container = container;

			this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor() {
				videoInfo = new VideoInfo() { MediaUri = args.streamUri, Resolution = new Size() { Width = args.sourceResolution.Width, Height = args.sourceResolution.Height } },
				videoSourceResolution = new Size() { Width = args.encoderResolution.Width, Height = args.encoderResolution.Height }
			};

			this.videoInfo = videoDescr.videoInfo;


			try {
				modulDescr.schema.GlobalTypes.Values.ForEach(x => {
					var val = x as global::System.Xml.Schema.XmlSchemaSimpleType;
					if (val == null)
						return;
					if (val.QualifiedName.Name == "sensitivity") {
						var tm1 = val.Content as System.Xml.Schema.XmlSchemaSimpleTypeRestriction;
						if (tm1 == null)
							return;
						var tm2 = tm1.Facets as System.Collections.CollectionBase;
						if (tm2 == null)
							return;

						tm2.ForEach(xx => {
							var min = xx as System.Xml.Schema.XmlSchemaMinInclusiveFacet;
							if (min != null) {
								int mval = 0;
								Int32.TryParse(min.Value, out mval);
								valueSensitivity.Minimum = mval;
							}
							var max = xx as System.Xml.Schema.XmlSchemaMaxInclusiveFacet;
							if (max != null) {
								int mval = 0;
								Int32.TryParse(max.Value, out mval);
								valueSensitivity.Maximum = mval;
							}
						});
					}
				});
			} catch (Exception err) {
				dbg.Error(err);
			}
			try {
				VideoStartup(args);
				InitApproEditor();
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}

			return true;
		}
		void RunMagicBoxTripWireRule(StreamInfoArgs args, Model model) {
			AnalyticsVideoDescriptor videoDescr = new AnalyticsVideoDescriptor();
			ModuleDescriptor moduleDescriptor = new ModuleDescriptor(model.config, model.configDescription, model.schemes);

			SynesisTripWireRuleView customview = new SynesisTripWireRuleView();
			bool retres = customview.Init(activityContext.container, args, moduleDescriptor);
			if (!retres) {
				Error(new Exception("Module is in unproper state. Please delete and create new one."));
			}
			Apply = customview.Apply;

			StartConfiguring(customview);
			controlDisposable = customview;
		}
		void VideoStartup(StreamInfoArgs args) {//, string profToken) {
			vidBuff = new VideoBuffer((int)args.sourceResolution.Width, (int)args.sourceResolution.Height);

			//var playerAct = container.Resolve<IVideoPlayerActivity>();
			////profileToken: profToken,
			//var model = new VideoPlayerActivityModel(
			//    showStreamUrl: false,
			//    streamSetup: new StreamSetup() {
			//        Stream = StreamType.RTPUnicast,
			//        Transport = new Transport() {
			//            Protocol = AppDefaults.visualSettings.Transport_Type,
			//            Tunnel = null
			//        }
			//    }
			//);

			//disposables.Add(
			//    container.RunChildActivity(player, model, (c, m) => playerAct.Run(c, m))
			//);
			VideoPlayerView playview = new VideoPlayerView();
			disposables.Add(playview);

			player.Child = playview;

			playview.Init(new VideoPlayerView.Model(
				streamSetup: args.streamSetup,
				mediaUri: new MediaUri() {
					uri = args.streamUri
				},
				encoderResolution: new VideoResolution() {
					height = (int)args.sourceResolution.Height,
					width = (int)args.sourceResolution.Width
				},
				isUriEnabled: false,
				metadataReceiver: null
			));

		}
		public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr) {
			this.modulDescr = modulDescr;
			this.container = container;

			this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor() {
				videoInfo = new VideoInfo() { MediaUri = args.streamUri, Resolution = new Size() { Width = args.sourceResolution.Width, Height = args.sourceResolution.Height } },
				videoSourceResolution = new Size() { Width = args.encoderResolution.Width, Height = args.encoderResolution.Height }
			};

			this.videoInfo = videoDescr.videoInfo;

			videoSourceSize = new Size(videoDescr.videoSourceResolution.Width, videoDescr.videoSourceResolution.Height);
			videoEncoderSize = new Size(videoDescr.videoInfo.Resolution.Width, videoDescr.videoInfo.Resolution.Height);

			model = new SynesisRegionRuleModel();

			try {
				FillElementItems(modulDescr.config.parameters.elementItem, model);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				BindData();
				VideoStartup(args);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			return true;
		}
        public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr) {
			this.modulDescr = modulDescr;
			this.container = container;

			this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor() {
				videoInfo = new VideoInfo() { MediaUri = args.streamUri, Resolution = new Size() {  Width = args.sourceResolution.Width, Height = args.sourceResolution.Height } },
				videoSourceResolution = new Size() { Width = args.encoderResolution.Width, Height = args.encoderResolution.Height } 
			};


            model = new SynesisAnalyticsModel();
            
            FillData(modulDescr.config.parameters.simpleItem, model);
            BindData();
			VideoStartup(args);
            return true;
        }
		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>> LoadStreamInfoNVA(NVALinkEventArgs args, StreamInfoHelper parent) {
			StreamInfoArgs strInfoArgs = new StreamInfoArgs(args.session);
			//strInfoArgs.encoderResolution = new Size(args.profile.VideoEncoderConfiguration.Resolution.Width, args.profile.VideoEncoderConfiguration.Resolution.Height);

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

			strInfoArgs.streamSetup = strsetup;

			yield return args.session.GetAnalyticsDeviceStreamUri(strsetup, args.control.token).Select(muri => {
				strInfoArgs.streamUri = muri;

				parent.args = strInfoArgs;
				return (Unit)null;
			});
			var inputtoken = "";
			try {
				inputtoken = args.control.inputToken.First();
			} catch (Exception err) {
				dbg.Error(err);
			}

			yield return args.session.GetAnalyticsEngineInput(inputtoken).Select(inp => {
				strInfoArgs.encoderResolution = new Size(inp.videoInput.resolution.width, inp.videoInput.resolution.height);
				strInfoArgs.sourceResolution = new Size(inp.videoInput.resolution.width, inp.videoInput.resolution.height);
				return (Unit)null;
			});
		}
		public bool Init(IUnityContainer container, StreamInfoArgs args, odm.ui.activities.ConfigureAnalyticView.ModuleDescriptor modulDescr) {
			this.modulDescr = modulDescr;
			this.container = container;

			try {
				this.videoDescr = new ConfigureAnalyticView.AnalyticsVideoDescriptor() {
					videoInfo = new VideoInfo() { MediaUri = args.streamUri, Resolution = new Size() { Width = args.sourceResolution.Width, Height = args.sourceResolution.Height } },
					videoSourceResolution = new Size() { Width = args.encoderResolution.Width, Height = args.encoderResolution.Height }
				};

				VideoStartup(args);//, videoDescr.profileToken);

				videoSourceSize = new Size(videoDescr.videoSourceResolution.Width, videoDescr.videoSourceResolution.Height);
				videoEncoderSize = new Size(videoDescr.videoInfo.Resolution.Width, videoDescr.videoInfo.Resolution.Height);

				model = new SynesisAnalyticsModel(modulDescr.schema);

			} catch (Exception err) {
				return false;
			}

			try {
				FillSimpleItems(modulDescr.config.parameters.simpleItem, model);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				FillElementItems(modulDescr.config.parameters.elementItem, model);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				pageAntishaker.Init(container, model, videoDescr.videoInfo);//, videoDescr.profileToken);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				pageDepthCalibration.Init(container, model, videoDescr.videoInfo);//, videoDescr.profileToken);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				pageObjectTracker.Init(container, model, videoDescr.videoInfo);//, videoDescr.profileToken);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}
			try {
				pageTampering.Init(container, model, videoDescr.videoInfo);//, videoDescr.profileToken);
			} catch (Exception err) {
				dbg.Error(err);
				return false;
			}

			analyticsTabCtrl.RequestBringIntoView += new RequestBringIntoViewEventHandler((sender, evargs) => {
				var tab = ((System.Windows.Controls.Primitives.Selector)(sender)).SelectedItem;
				var tctrl = tab as TabItem;
				if (tctrl.Name == tabAntishaker.Name) {
					pageAntishaker.SetPlayer(null);
					pageDepthCalibration.SetPlayer(null);
					pageObjectTracker.SetPlayer(null);
					pageTampering.SetPlayer(null);

					pageAntishaker.SetPlayer(player);
				} else if (tctrl.Name == tabDepthCalibration.Name) {
					pageAntishaker.SetPlayer(null);
					pageDepthCalibration.SetPlayer(null);
					pageObjectTracker.SetPlayer(null);
					pageTampering.SetPlayer(null);

					pageDepthCalibration.SetPlayer(player);

				} else if (tctrl.Name == tabObjectTracker.Name) {
					pageAntishaker.SetPlayer(null);
					pageDepthCalibration.SetPlayer(null);
					pageObjectTracker.SetPlayer(null);
					pageTampering.SetPlayer(null);

					pageObjectTracker.SetPlayer(player);

				} else if (tctrl.Name == tabTampering.Name) {
					pageAntishaker.SetPlayer(null);
					pageDepthCalibration.SetPlayer(null);
					pageObjectTracker.SetPlayer(null);
					pageTampering.SetPlayer(null);

					pageTampering.SetPlayer(player);

				}
			});

			//TODO: Stub fix for #225 Remove this with plugin functionality
			last = container.Resolve<odm.ui.activities.ILastChangedModule>();
			analyticsTabCtrl.SelectionChanged += new SelectionChangedEventHandler((obj, arg) => {
				var selection = analyticsTabCtrl.SelectedItem as TabItem;
				var antishaker = selection.Content as AntishakerView;
				if (antishaker != null) {
					last.Tag = "pageAntishaker";
				}
				var calibration = selection.Content as DepthCalibrationView;
				if (calibration != null) {
					last.Tag = "pageDepthCalibration";
				}
				var objecttracker = selection.Content as ObjectTrackerView;
				if (objecttracker != null) {
					last.Tag = "pageObjectTracker";
				}
				var tampering = selection.Content as TamperingDetectorsView;
				if (tampering != null) {
					last.Tag = "pageTampering";
				}
			});
			if (last.Tag != "") {
				switch (last.Tag) {
					case "pageAntishaker":
						analyticsTabCtrl.SelectedItem = tabAntishaker;

						pageDepthCalibration.SetPlayer(null);
						pageTampering.SetPlayer(null);
						pageObjectTracker.SetPlayer(null);

						pageAntishaker.SetPlayer(player);
						break;
					case "pageDepthCalibration":
						analyticsTabCtrl.SelectedItem = tabDepthCalibration;

						pageTampering.SetPlayer(null);
						pageAntishaker.SetPlayer(null);
						pageObjectTracker.SetPlayer(null);

						pageDepthCalibration.SetPlayer(player);
						break;
					case "pageObjectTracker":
						analyticsTabCtrl.SelectedItem = tabObjectTracker;

						pageDepthCalibration.SetPlayer(null);
						pageTampering.SetPlayer(null);
						pageAntishaker.SetPlayer(null);

						pageObjectTracker.SetPlayer(player);

						break;
					case "pageTampering":
						analyticsTabCtrl.SelectedItem = tabTampering;

						pageDepthCalibration.SetPlayer(null);
						pageObjectTracker.SetPlayer(null);
						pageAntishaker.SetPlayer(null);

						pageTampering.SetPlayer(player);
						break;
				}
			} else {
				pageDepthCalibration.SetPlayer(null);
				pageTampering.SetPlayer(null);
				pageAntishaker.SetPlayer(null);
				pageObjectTracker.SetPlayer(player);
			}
			//

			return true;
		}
		void VideoStartup(StreamInfoArgs args) {//, string profToken) {
			vidBuff = new VideoBuffer((int)args.sourceResolution.Width, (int)args.sourceResolution.Height);

			VideoPlayerView playview = new VideoPlayerView();
			disposables.Add(playview);

			player.Child = playview;

			playview.Init(new VideoPlayerView.Model(
				streamSetup: args.streamSetup,
				mediaUri: new MediaUri() {
					uri = args.streamUri
				},
				encoderResolution: new VideoResolution() {
					height = (int)args.sourceResolution.Height,
					width = (int)args.sourceResolution.Width
				},
				isUriEnabled: false,
				metadataReceiver: null
			));
		}