Beispiel #1
0
        void ReceiversClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "ReceiversClick", RegionNames.reg_property);

            column.CreateBinding(ContentColumn.TitleProperty, LocalTitles.instance, x => x.receivers);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            var uri = evarg.session.deviceUri;

            ctx.RegisterInstance <Uri>(uri);

            Ctxdisp = ctx;

            //ReceiversView review = new ReceiversView();
            //review.Init(null);
            //ShowView(review, "receiver_view", RegionNames.reg_property);

            UIdisp = ReceiverManagementActivity
                     .Run(ctx)
                     .Subscribe(x => {
            }, err => {
                dbg.Error(err);
            });
        }
Beispiel #2
0
        protected DeviceLinkEventArgs GetEventArg()
        {
            var evArg = new DeviceLinkEventArgs();

            evArg.currentAccount = currentAccount;
            evArg.session        = session;
            return(evArg);
        }
        public ToolBarView(IUnityContainer container)
        {
            eventAggregator = container.Resolve <IEventAggregator>();

            this.CommandBindings.Add(
                new CommandBinding(
                    ToolBarView.AppSettingsCommand,
                    (s, a) => {
                var evarg            = new DeviceLinkEventArgs();
                evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                evarg.session        = null;
                eventAggregator.GetEvent <AppSettingsClick>().Publish(true);
            }
                    )
                );
            this.CommandBindings.Add(
                new CommandBinding(
                    ToolBarView.AccountSettingsCommand,
                    (s, a) => {
                var evarg            = new DeviceLinkEventArgs();
                evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                evarg.session        = null;
                eventAggregator.GetEvent <AccountManagerClick>().Publish(evarg);
            }
                    )
                );

            this.CommandBindings.Add(
                new CommandBinding(
                    ToolBarView.BackgroundTasksCommand,
                    (s, a) => {
                var evarg            = new DeviceLinkEventArgs();
                evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                evarg.session        = null;
                eventAggregator.GetEvent <BackgroundTasksClick>().Publish(true);
            }
                    )
                );

            this.CommandBindings.Add(
                new CommandBinding(
                    ToolBarView.AboutCommand,
                    (s, a) => {
                var evarg            = new DeviceLinkEventArgs();
                evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                evarg.session        = null;
                eventAggregator.GetEvent <AboutClick>().Publish(evarg);
            }
                    )
                );


            InitializeComponent();
            auth.Content = new AuthView(container); // TODO how to pass the container?
        }
		public ToolBarView(IUnityContainer container) {

			eventAggregator = container.Resolve<IEventAggregator>();

			this.CommandBindings.Add(
				new CommandBinding(
					ToolBarView.AppSettingsCommand,
					(s, a) => {
						var evarg = new DeviceLinkEventArgs();
						evarg.currentAccount = AccountManager.Instance.CurrentAccount;
						evarg.session = null;
						eventAggregator.GetEvent<AppSettingsClick>().Publish(true);
					}
				)
			);
            this.CommandBindings.Add(
                new CommandBinding(
                    ToolBarView.AccountSettingsCommand,
                    (s, a) => {
                        var evarg = new DeviceLinkEventArgs();
                        evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                        evarg.session = null;
                        eventAggregator.GetEvent<AccountManagerClick>().Publish(evarg);
                    }
                )
            );
            
			this.CommandBindings.Add(
				new CommandBinding(
					ToolBarView.BackgroundTasksCommand,
					(s, a) => {
                        var evarg = new DeviceLinkEventArgs();
                        evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                        evarg.session = null;
                        eventAggregator.GetEvent<BackgroundTasksClick>().Publish(true);
					}
				)
			);

			this.CommandBindings.Add(
				 new CommandBinding(
					  ToolBarView.AboutCommand,
					  (s, a) => {
						  var evarg = new DeviceLinkEventArgs();
						  evarg.currentAccount = AccountManager.Instance.CurrentAccount;
						  evarg.session = null;
						  eventAggregator.GetEvent<AboutClick>().Publish(evarg);
					  }
				 )
			);
            
            
			InitializeComponent();
            auth.Content = new AuthView(container); // TODO how to pass the container?
		}
Beispiel #5
0
        void WebPageClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            var view = container.Resolve <WebPageView>();

            view.DataContext = view;
            var baseOfDeviceUrl = new Uri(evarg.session.deviceUri.GetLeftPart(UriPartial.Authority));

            view.NavigateTo(baseOfDeviceUrl);
            ShowView(view, "deviceweb_view", RegionNames.reg_property);
        }
Beispiel #6
0
        void DigitalIOClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            var view      = container.Resolve <DigitalIOView>();
            var viewModel = view.DataContext as DigitalIOViewModel;

            if (viewModel != null)
            {
                viewModel.Init(evarg.session, evarg.currentAccount);
            }
            ShowView(view, "digitalio_view", RegionNames.reg_property);
        }
Beispiel #7
0
        void AboutClick(DeviceLinkEventArgs evarg)
        {
            var ctx = new ModalDialogContext();

            AboutView
            .Show(ctx)
            .Subscribe(
                result => {
                ctx.Dispose();
            },
                error => {
                ctx.Dispose();
                dbg.Error(error);
            }
                );
        }
Beispiel #8
0
        void SequrityClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

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

            Ctxdisp = ctx;

            UIdisp = CertificateManagementActivity
                     .Run <IUnityContainer>(ctx)
                     .Subscribe(x => {
            }, err => {
                dbg.Error(err);
            });
        }
Beispiel #9
0
        void DateTimeClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

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

            Ctxdisp = ctx;

            UIdisp = TimeSettingsActivity
                     .Run(ctx)
                     .Subscribe(x => {
            }, err => {
                dbg.Error(err);
            });
        }
Beispiel #10
0
        void ActionTriggersClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

            ShowView(column, "ActionTriggersClick", RegionNames.reg_property);

            column.CreateBinding(ContentColumn.TitleProperty, LocalTitles.instance, x => x.triggers);
            var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

            Ctxdisp = ctx;

            UIdisp = ActionTriggerManagementActivity
                     .Run(ctx)
                     .Subscribe(x => {
            }, err => {
                dbg.Error(err);
            });
        }
 void InitCommands()
 {
     OnAboutClick = new DelegateCommand(() => {
         var evarg            = new DeviceLinkEventArgs();
         evarg.currentAccount = AccountManager.CurrentAccount;
         evarg.session        = null;
         eventAggregator.GetEvent <AboutClick>().Publish(evarg);
     });
     AccountClick = new DelegateCommand(() => {
         var evarg            = new DeviceLinkEventArgs();
         evarg.currentAccount = AccountManager.CurrentAccount;
         evarg.session        = null;
         eventAggregator.GetEvent <AccountManagerClick>().Publish(evarg);
     });
     ApplyClick = new DelegateCommand(() => {
         OnAccountApply();
     });
     PropertiesClick = new DelegateCommand(() => {
         eventAggregator.GetEvent <PropertiesClick>().Publish(true);
     });
 }
Beispiel #12
0
        void IdentificationClick(DeviceLinkEventArgs evarg)
        {
            ReleaseViewModels(RegionNames.reg_property);

            ContentColumn column = new ContentColumn();

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

            var uri = evarg.session.deviceUri;

            ctx.RegisterInstance <Uri>(uri);

            Ctxdisp = ctx;

            UIdisp = IdentificationActivity
                     .Run(ctx)
                     .Subscribe(x => {
            }, err => {
                dbg.Error(err);
            });
        }
		void IdentificationClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

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

			var uri = evarg.session.deviceUri;
			ctx.RegisterInstance<Uri>(uri);

			Ctxdisp = ctx;

			UIdisp = IdentificationActivity
				.Run(ctx)
				.Subscribe(x => {
				}, err => {
					dbg.Error(err);
				});
		}
 protected DeviceLinkEventArgs GetEventArg(){
     var evArg = new DeviceLinkEventArgs();
     evArg.currentAccount = currentAccount;
     evArg.session = session;
     return evArg;
 }
        public BackgroundTasksView(IActivityContext <Unit> context)
        {
            this.context = context;
            InitializeComponent();

            Localization();
            IEventAggregator eventAggregator = null;

            try {
                eventAggregator = context.container.Resolve <IEventAggregator>();
            } catch (Exception err) {
                dbg.Error(err);
            }

            CommandBindings.Add(
                new CommandBinding(
                    CloseCommand,
                    (s, a) => {
                //view.Dispose();
                Success();
            }
                    )
                );
            CommandBindings.Add(
                new CommandBinding(
                    RemoveTaskCommand,
                    (s, a) => {
                var backgroundTask = a.Parameter as IBackgroundTask;
                if (backgroundTask != null)
                {
                    BackgroundTaskManager.tasks.Remove(backgroundTask);
                    backgroundTask.Dispose();
                }
            }
                    )
                );
            CommandBindings.Add(
                new CommandBinding(
                    CancelTaskCommand,
                    (s, a) => {
                var backgroundTask = a.Parameter as IBackgroundTask;
                if (backgroundTask != null)
                {
                    backgroundTask.Dispose();
                }
            }
                    )
                );
            CommandBindings.Add(
                new CommandBinding(
                    AddUpgradeBatchCommand,
                    (s, a) => {
                var evarg            = new DeviceLinkEventArgs();
                evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                evarg.session        = null;
                eventAggregator.GetEvent <UpgradeButchClick>().Publish(true);
            }
                    )
                );
            CommandBindings.Add(
                new CommandBinding(
                    AddRestoreBatchCommand,
                    (s, a) => {
                var evarg            = new DeviceLinkEventArgs();
                evarg.currentAccount = AccountManager.Instance.CurrentAccount;
                evarg.session        = null;
                eventAggregator.GetEvent <RestoreButchClick>().Publish(true);
            }
                    )
                );
            CommandBindings.Add(
                new CommandBinding(
                    CancelAllRunningTasksCommand,
                    (s, a) => {
                foreach (var t in BackgroundTaskManager.tasks)
                {
                    t.Dispose();
                }
            }
                    )
                );
            CommandBindings.Add(
                new CommandBinding(
                    RemoveAllFinishedTasksCommand,
                    (s, a) => {
                var tasks = BackgroundTaskManager.tasks.Where(t => t.state != BackgroundTaskState.InProgress).ToList();
                foreach (var t in tasks)
                {
                    try {
                        BackgroundTaskManager.tasks.Remove(t);
                        t.Dispose();
                    } catch (Exception err) {
                        dbg.Error(err);
                    }
                }
            }
                    )
                );
        }
		void ActionTriggersClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "ActionTriggersClick", RegionNames.reg_property);

			column.CreateBinding(ContentColumn.TitleProperty, LocalTitles.instance, x => x.triggers);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

			Ctxdisp = ctx;

			UIdisp = ActionTriggerManagementActivity
				 .Run(ctx)
				 .Subscribe(x => {
				 }, err => {
					 dbg.Error(err);
				 });
		}
		void SequrityClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

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

			UIdisp = CertificateManagementActivity
				.Run<IUnityContainer>(ctx)
				.Subscribe(x => {
				}, err => {
					dbg.Error(err);
				});
		}
		void DigitalIOClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			var view = container.Resolve<DigitalIOView>();
			var viewModel = view.DataContext as DigitalIOViewModel;
			if (viewModel != null) {
				viewModel.Init(evarg.session, evarg.currentAccount);
			}
			ShowView(view, "digitalio_view", RegionNames.reg_property);
		}
		void DateTimeClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

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

			UIdisp = TimeSettingsActivity
				.Run(ctx)
				.Subscribe(x => {
				}, err => {
					dbg.Error(err);
				});
		}
		void ReceiversClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			ContentColumn column = new ContentColumn();
			ShowView(column, "ReceiversClick", RegionNames.reg_property);

			column.CreateBinding(ContentColumn.TitleProperty, LocalTitles.instance, x => x.receivers);
			var ctx = CreateActivityContext(RegionNames.reg_property, evarg.session, column);

			var uri = evarg.session.deviceUri;
			ctx.RegisterInstance<Uri>(uri);

			Ctxdisp = ctx;

			//ReceiversView review = new ReceiversView();
			//review.Init(null);
			//ShowView(review, "receiver_view", RegionNames.reg_property);

			UIdisp = ReceiverManagementActivity
				.Run(ctx)
				.Subscribe(x => {
				}, err => {
					dbg.Error(err);
				});
		}
		public BackgroundTasksView(IActivityContext<Unit> context) {
			this.context = context;
			InitializeComponent();

			Localization();
			IEventAggregator eventAggregator = null;
			try {
				eventAggregator = context.container.Resolve<IEventAggregator>();
			} catch (Exception err) {
				dbg.Error(err);
			}

			CommandBindings.Add(
				new CommandBinding(
					CloseCommand,
					(s, a) => {
						//view.Dispose();
						Success();
					}
				)
			);
			CommandBindings.Add(
				new CommandBinding(
					RemoveTaskCommand,
					(s, a) => {
						var backgroundTask = a.Parameter as IBackgroundTask;
						if (backgroundTask != null) {
							BackgroundTaskManager.tasks.Remove(backgroundTask);
							backgroundTask.Dispose();
						}
					}
				)
			);
			CommandBindings.Add(
				new CommandBinding(
					CancelTaskCommand,
					(s, a) => {
						var backgroundTask = a.Parameter as IBackgroundTask;
						if (backgroundTask != null) {
							backgroundTask.Dispose();
						}
					}
				)
			);
			CommandBindings.Add(
				new CommandBinding(
					AddUpgradeBatchCommand,
					(s, a) => {
						var evarg = new DeviceLinkEventArgs();
						evarg.currentAccount = AccountManager.Instance.CurrentAccount;
						evarg.session = null;
						eventAggregator.GetEvent<UpgradeButchClick>().Publish(true);
					}
				)
			);
			CommandBindings.Add(
				new CommandBinding(
					AddRestoreBatchCommand,
					(s, a) => {
						var evarg = new DeviceLinkEventArgs();
						evarg.currentAccount = AccountManager.Instance.CurrentAccount;
						evarg.session = null;
						eventAggregator.GetEvent<RestoreButchClick>().Publish(true);
					}
				)
			);
			CommandBindings.Add(
				new CommandBinding(
					CancelAllRunningTasksCommand,
					(s, a) => {
						foreach (var t in BackgroundTaskManager.tasks) {
							t.Dispose();
						}
					}
				)
			);
			CommandBindings.Add(
				new CommandBinding(
					RemoveAllFinishedTasksCommand,
					(s, a) => {
						var tasks = BackgroundTaskManager.tasks.Where(t => t.state != BackgroundTaskState.InProgress).ToList();
						foreach (var t in tasks) {
							try {
								BackgroundTaskManager.tasks.Remove(t);
								t.Dispose();
							} catch (Exception err) {
								dbg.Error(err);
							}
						}
					}
				)
			);

		}
		void AboutClick(DeviceLinkEventArgs evarg) {
			var ctx = new ModalDialogContext();
			AboutView
				.Show(ctx)
				.Subscribe(
					result => {
						ctx.Dispose();
					},
					error => {
						ctx.Dispose();
						dbg.Error(error);
					}
				);
		}
 void InitCommands() {
     OnAboutClick = new DelegateCommand(() => {
         var evarg = new DeviceLinkEventArgs();
         evarg.currentAccount = AccountManager.CurrentAccount;
         evarg.session = null;
         eventAggregator.GetEvent<AboutClick>().Publish(evarg);
     });
     AccountClick = new DelegateCommand(() => {
         var evarg = new DeviceLinkEventArgs();
         evarg.currentAccount = AccountManager.CurrentAccount;
         evarg.session = null;
         eventAggregator.GetEvent<AccountManagerClick>().Publish(evarg);
     });
     ApplyClick = new DelegateCommand(() => {
         OnAccountApply();
     });
     PropertiesClick = new DelegateCommand(() => {
         eventAggregator.GetEvent<PropertiesClick>().Publish(true);
     });
 }
		void WebPageClick(DeviceLinkEventArgs evarg) {
			ReleaseViewModels(RegionNames.reg_property);

			var view = container.Resolve<WebPageView>();
			view.DataContext = view;
			var baseOfDeviceUrl = new Uri(evarg.session.deviceUri.GetLeftPart(UriPartial.Authority));
			view.NavigateTo(baseOfDeviceUrl);
			ShowView(view, "deviceweb_view", RegionNames.reg_property);
		}