예제 #1
0
 public MainViewModel(IWindowManager windowManager, IDialogService dialogService)
 {
     DisplayName = "Subtitle finder";
     this.dialogService = dialogService;
     this.windowManager = windowManager;
     Subtitles = new CollectionViewSource {Source = subtitles};
 }
예제 #2
0
 public DialogManager(IAddLibraryViewModelFactory add_library_factory,
     IWindowManager manager, LibrarySorterRepository repository)
 {
     add_library_factory_ = add_library_factory;
     manager_ = manager;
     repository_ = repository;
 }
예제 #3
0
		//Metodo principal en el cual se creara el servicio y pintaremos nuestro imageview sobre la ventana
		public override void OnCreate ()
		{
			base.OnCreate ();
			//incializaremos en windowmanager obteniendo el servicio directo de la ventan del sistema y haremos
			//un casting de tipo JavaCast<IWindowManager>
			windowManager = GetSystemService ("window").JavaCast<IWindowManager> ();
			//inicializaremos nuestro imageview dandole los atributos de nuestra clase para que obtenga los metodos
			//de touch
			chatHead = new ImageView(this);
			//definimos la imagen del imageview
			chatHead.SetImageResource (Resource.Drawable.ic_launcher);
			//Asignamos el listener del touch nuestra clase del tipo View.IOnTouchListener
			chatHead.SetOnTouchListener (this);
			//instanciamos los parametros que necesitamos para poder tomar la pantalla y asi poder mostrar nuestro imageview
			param = new WindowManagerLayoutParams(
				WindowManagerLayoutParams.WrapContent,
				WindowManagerLayoutParams.WrapContent,
				WindowManagerTypes.Phone,
				WindowManagerFlags.NotFocusable,
				Format.Translucent);
			//Agregamos la propiedad de gravedad en la parte de arriba hacia la izquieda
			param.Gravity = GravityFlags.Top | GravityFlags.Left;
			//Asignamos la posicion X del imageview
			param.X = 0;
			//Asignamos la posicion Y del imageview
			param.Y = 100;
			//Agregamos una vista a la ventana del sistema con nuestro imageview y los parametros generados
			windowManager.AddView (chatHead, param);
		}
        public StockMinListadoViewModel(IWindowManager windowmanager)
        {
            _windowManager = windowmanager;
            Usuario u = new Usuario();
            u = DataObjects.Seguridad.UsuarioSQL.buscarUsuarioPorIdUsuario(Int32.Parse(Thread.CurrentPrincipal.Identity.Name));
            idTienda = u.IdTienda;
            idResponsable = u.IdUsuario;

            if (idTienda > 0) Enable = false;
            else Enable = true;

            Tienda central = new Tienda();
            central.Nombre = "ALMACEN CENTRAL";
            central.IdTienda = 0;

            TiendaSQL tSQL = new TiendaSQL();
            CmbTiendas = tSQL.BuscarTienda();
            CmbTiendas.Insert(0, central);

            Index = this.CmbTiendas.FindIndex(x => x.IdTienda == idTienda);

            if (idTienda > 0)
            {
                ProductoSQL pSQL = new ProductoSQL();
                LstProductos = pSQL.BuscarProductoxTienda(idTienda, true);
            }
            else
            {
                ProductoSQL pSQL = new ProductoSQL();
                LstProductos = pSQL.BuscarProductoxCentral(1,-1, true);
            }
        }
예제 #5
0
        public DocumentViewModel(
            IDialogService dialogService,
            IWindowManager windowManager,
            ISiteContextGenerator siteContextGenerator,
            Func<string, IMetaWeblogService> getMetaWeblog,
            ISettingsProvider settingsProvider,
            IDocumentParser documentParser)
        {
            this.dialogService = dialogService;
            this.windowManager = windowManager;
            this.siteContextGenerator = siteContextGenerator;
            this.getMetaWeblog = getMetaWeblog;
            this.settingsProvider = settingsProvider;
            this.documentParser = documentParser;

            FontSize = GetFontSize();

            title = "New Document";
            Original = "";
            Document = new TextDocument();
            Post = new Post();
            timer = new DispatcherTimer();
            timer.Tick += TimerTick;
            timer.Interval = delay;
        }
예제 #6
0
        public ShellViewModel(IWindowManager wm, IScannerService scannerService)
        {
            this.scannerService = scannerService;
            IsProgressVisible = Visibility.Hidden;

            FetchScanners();
        }
        public MainViewModel(IEventAggregator eventAggregator, IWindowManager windowManager)
        {
            _eventAggregator = eventAggregator;
            _windowManager = windowManager;

            base.DisplayName = "Open Serial Port Monitor";// +Assembly.GetExecutingAssembly().GetName().Version;
        }
        public ConflictResolutionViewModel(
            ISyncthingManager syncthingManager,
            IConflictFileManager conflictFileManager,
            IProcessStartProvider processStartProvider,
            IConflictFileWatcher conflictFileWatcher,
            IWindowManager windowManager,
            IConfigurationProvider configurationProvider)
        {
            this.syncthingManager = syncthingManager;
            this.conflictFileManager = conflictFileManager;
            this.processStartProvider = processStartProvider;
            this.conflictFileWatcher = conflictFileWatcher;
            this.configurationProvider = configurationProvider;
            this.windowManager = windowManager;

            this.DeleteToRecycleBin = this.configurationProvider.Load().ConflictResolverDeletesToRecycleBin;
            this.Bind(s => s.DeleteToRecycleBin, (o, e) => this.configurationProvider.AtomicLoadAndSave(c => c.ConflictResolverDeletesToRecycleBin = e.NewValue));

            this.Conflicts.CollectionChanged += (o, e) =>
            {
                if ((e.Action == NotifyCollectionChangedAction.Add && (e.OldItems?.Count ?? 0) == 0) ||
                    (e.Action == NotifyCollectionChangedAction.Remove && (e.NewItems?.Count ?? 0) == 0) ||
                    (e.Action == NotifyCollectionChangedAction.Reset))
                {
                    this.NotifyOfPropertyChange(nameof(this.Conflicts));
                    this.NotifyOfPropertyChange(nameof(this.IsLoadingAndNoConflictsFound));
                    this.NotifyOfPropertyChange(nameof(this.HasFinishedLoadingAndNoConflictsFound));

                    if (this.SelectedConflict == null && this.Conflicts.Count > 0)
                        this.SelectedConflict = this.Conflicts[0];
                }
            };
        }
 public DevolucionesRegistrarViewModel(IWindowManager windowmanager, DevolucionesBuscarViewModel window, int idDevolucion = -1)
 {
     _windowManager = windowmanager;
     this.window = window;
     if (idDevolucion > 0)
     {
         this.idDevolucion = idDevolucion;
         this.ObtenerProductosVenta();
         IndMantenimiento = DETALLE;
         IsReadOnly = true;
         if ((new DevolucionSQL()).puedeAnular(idDevolucion))
             CanDelete = Visibility.Visible;
         else
             CanDelete = Visibility.Collapsed;
         CanSave = Visibility.Collapsed;
         ViewDni = Visibility.Collapsed;
     }
     else
     {
         IndMantenimiento = REGISTRO;
         IsReadOnly = false;
         CanDelete = Visibility.Collapsed;
         CanSave = Visibility.Visible;
         ViewDni = Visibility.Visible;
     }
 }
        public SettingsViewModel(ISettingsService settingsService, IWindowManager windowManager, Func<BlogSettingsViewModel> blogSettingsCreator)
        {
            this.settingsService = settingsService;
            this.windowManager = windowManager;
            this.blogSettingsCreator = blogSettingsCreator;

            using (RegistryKey key = Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Classes"))
            {
                FileMDBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[0]) &&
                    !string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[0]).GetValue("").ToString());

                FileMarkdownBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[1]) &&
                    !string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[1]).GetValue("").ToString());

                FileMDownBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[2]) &&
                    !string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[2]).GetValue("").ToString());

                FileMKDBinding = key.GetSubKeyNames().Contains(Constants.DefaultExtensions[3]) &&
                    !string.IsNullOrEmpty(key.OpenSubKey(Constants.DefaultExtensions[3]).GetValue("").ToString());
            }

            var blogs = settingsService.Get<List<BlogSetting>>("Blogs") ?? new List<BlogSetting>();

            Blogs = new ObservableCollection<BlogSetting>(blogs);
        }
예제 #11
0
        public MainController(MainWindow window, 
            IWindowManager windowManager,
            IStoredClassDataPresenter storedClassDataPresenter,
            IConnectionPresenter connectionPresenter,
            IStoredClassPresenter storedClassPresenter,
            IFieldPresenter fieldPresenter,
            IFieldListPresenter fieldListPresenter,
            IConnectionStatisticsPresenter connectionStatisticsPresenter
            )
        {
            this.window = window;
            this.windowManager = windowManager;
            this.storedClassDataPresenter = storedClassDataPresenter;
            this.connectionPresenter = connectionPresenter;
            this.storedClassPresenter = storedClassPresenter;

            this.window.explorer.ShowDataFired += storedClassDataPresenter.ShowData;
            this.window.explorer.ShowFieldsFired += fieldListPresenter.ShowFields;
            this.window.AddNewConnectionFired += this.connectionPresenter.AddNew;

            this.window.explorer.EditConnectionFired += this.connectionPresenter.Edit;
            this.window.explorer.DeleteConnectionFired += this.connectionPresenter.Delete;
            this.window.explorer.RenameClassFired += storedClassPresenter.RenameClass;
            this.window.explorer.RenameFieldFired += fieldPresenter.RenameField;
            this.window.explorer.ShowStatisticsFired += connectionStatisticsPresenter.Show;
            this.window.explorer.CreateNewStoredClassFired += storedClassPresenter.CreateNew;
        }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.SubtitlesViewModel"/> class.
        /// </summary>
        /// <param name="windowManager">
        /// The window manager.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public SubtitlesViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
        {
            this.Task = new EncodeTask();

            this.Langauges = LanguageUtilities.MapLanguages().Keys;
            this.CharacterCodes = CharCodesUtilities.GetCharacterCodes();
        }
예제 #13
0
        public void Execute(IWindowManager windowManager, IQuestionDialog questionDialog)
        {
            var question = new Question(
                null,
                Text,
                _possibleAnswers
                );

            questionDialog.Setup(
                Caption,
                new[] {question}
                );

            questionDialog.WasShutdown += delegate{
                if(_handleResult != null)
                    _handleResult(question.Answer);
                else if(question.Answer == Answer.No || question.Answer == Answer.Cancel)
                {
                    Completed(this, new CancelResult());
                    return;
                }

                Completed(this, null);
            };

            windowManager.ShowDialog(questionDialog, null, null);
        }
예제 #14
0
 public NewAirport(
     IWindowManager windowManager,
     NewAirportViewModel newAirport)
 {
     _windowManager = windowManager;
     _newAirport = newAirport;
 }
        public MantenerNotaDeIngresoViewModel(IWindowManager windowmanager)
        {
            _windowManager = windowmanager;
            pxaSQL = new ProductoSQL();
            this.cmbMotivo = DataObjects.Almacen.MotivoSQL.BuscarMotivos(1);
            AlmacenSQL aGW = new AlmacenSQL();
            u = DataObjects.Seguridad.UsuarioSQL.buscarUsuarioPorIdUsuario(Int32.Parse(Thread.CurrentPrincipal.Identity.Name));
            idTienda = u.IdTienda;
            Models.Almacen.Almacenes a;
            if (idTienda != 0)
            {
                //1 deposito
                //2 anaquel
                //3 central va al else
                a = aGW.BuscarAlmacen(-1, idTienda, 1);
            }
            else
            {
                a = aGW.BuscarAlmacen(-1, -1, 3);
            }

            List<Usuario> ul = new List<Usuario>();
            ul.Add(u);
            this.responsable = new List<Usuario>(ul);

            List<Models.Almacen.Almacenes> al = new List<Models.Almacen.Almacenes>();
            al.Add(a);
            this.almacen = al;
            Estado = true;
            EstadoMot = true;
            EstadoPro = true;
        }
예제 #16
0
        public ViewerViewModel(
            IWindowManager windowManager,
            ISyncThingManager syncThingManager,
            IConfigurationProvider configurationProvider,
            IProcessStartProvider processStartProvider,
            IApplicationPathsProvider pathsProvider)
        {
            this.windowManager = windowManager;
            this.syncThingManager = syncThingManager;
            this.processStartProvider = processStartProvider;
            this.configurationProvider = configurationProvider;
            this.pathsProvider = pathsProvider;

            var configuration = this.configurationProvider.Load();
            this.zoomLevel = configuration.SyncthingWebBrowserZoomLevel;

            this.syncThingManager.StateChanged += (o, e) =>
            {
                this.syncThingState = e.NewState;
                this.RefreshBrowser();
            };

            this.callback = new JavascriptCallbackObject(this.OpenFolder);

            this.Bind(x => x.WebBrowser, (o, e) =>
            {
                if (e.NewValue != null)
                    this.InitializeBrowser(e.NewValue);
            });

            this.SetCulture(configuration);
            configurationProvider.ConfigurationChanged += (o, e) => this.SetCulture(e.NewConfiguration);
        }
예제 #17
0
		public SimulationView (Context context, SensorManager sensorManager, IWindowManager window)
			: base (context)
		{
			Bounds = new PointF ();

			// Get an accelorometer sensor
			sensor_manager = sensorManager;
			accel_sensor = sensor_manager.GetDefaultSensor (SensorType.Accelerometer);

			// Calculate screen size and dpi
			var metrics = new DisplayMetrics ();
			window.DefaultDisplay.GetMetrics (metrics);

			meters_to_pixels_x = metrics.Xdpi / 0.0254f;
			meters_to_pixels_y = metrics.Ydpi / 0.0254f;

			// Rescale the ball so it's about 0.5 cm on screen
			var ball = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Ball);
			var dest_w = (int)(BALL_DIAMETER * meters_to_pixels_x + 0.5f);
			var dest_h = (int)(BALL_DIAMETER * meters_to_pixels_y + 0.5f);
			ball_bitmap = Bitmap.CreateScaledBitmap (ball, dest_w, dest_h, true);

			// Load the wood background texture
			var opts = new BitmapFactory.Options ();
			opts.InDither = true;
			opts.InPreferredConfig = Bitmap.Config.Rgb565;
			wood_bitmap = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Wood, opts);
			wood_bitmap2 = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Wood, opts);

			display = window.DefaultDisplay;
			particles = new ParticleSystem (this);
		}
예제 #18
0
        /// <summary>
        /// Creates a new ShellViewModel
        /// </summary>
        /// <param name="main">Main view model</param>
        /// <param name="manager">Window manager</param>
        /// <param name="task">Mangas task</param>
        /// <param name="tray">Tray icon</param>
        public ShellViewModel(MainViewModel main, IWindowManager manager, MangasTask task,
            TrayIcon tray)
        {
            main_ = main;
            manager_ = manager;
            open_ = false;
            task_ = task;
            tray_ = tray;

            task_.MangaUpdated += TaskMangaUpdated;

            tray_.ItemClicked += IconItemClicked;
            tray_.DoubleClicked += IconDoubleClicked;
            tray_.NotificationClicked += IconNotificationClicked;

            tray_.AddItem(kShow);
            tray_.AddSeparator();
            tray_.AddItem(kStart);
            tray_.AddItem(kStop);
            tray_.AddSeparator();
            tray_.AddItem(kExit);

            tray_.Show();

            task_.Start();
        }
예제 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HandBrakeWPF.ViewModels.SubtitlesViewModel"/> class.
        /// </summary>
        /// <param name="windowManager">
        /// The window manager.
        /// </param>
        /// <param name="userSettingService">
        /// The user Setting Service.
        /// </param>
        public SubtitlesViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
        {
            this.SubtitleTracks = new ObservableCollection<SubtitleTrack>();

            Langauges = LanguageUtilities.MapLanguages().Keys;
            CharacterCodes = CharCodesUtilities.GetCharacterCodes();
        }
예제 #20
0
 public NewConnection(
     IWindowManager windowManager, 
     NewConnectionViewModel newConnectionViewModel)
 {
     _windowManager = windowManager;
     _newConnectionViewModel = newConnectionViewModel;
 }
 public ManageUsersGroupsViewModel(UsersServiceProxy service, IWindowManager windowManager,
     ChangeUserRoleViewModel changeUserRoleViewModel)
 {
     this.service = service;
     this.windowManager = windowManager;
     this.changeUserRoleViewModel = changeUserRoleViewModel;
 }
예제 #22
0
		public ShellViewModel(IWindowManager windowManager, ISpotifyController spotifyController, ICoverService coverService, IEventAggregator eventAggregator, AppSettings settings, Core.ILog logger, IUpdateService updateService, IUsageTrackerService usageTrackerService, IBroadcastService broadcastService) {
			_WindowManager = windowManager;
			_SpotifyController = spotifyController;
			_CoverService = coverService;
			_EventAggregator = eventAggregator;
			_Settings = settings;
			_Logger = logger;
			_UpdateService = updateService;
			_UsageTrackerService = usageTrackerService;
			_BroadcastService = broadcastService;
			_ApplicationSize = _Settings.ApplicationSize;

			CoverImage = NoCoverUri;
			UpdateView();

			_SpotifyController.TrackChanged += (o, e) => UpdateView();
			_SpotifyController.SpotifyOpened += (o, e) => SpotifyOpened();
			_SpotifyController.SpotifyExited += (o, e) => SpotifyExited();
			_UpdateService.UpdateReady += UpdateReady;
			_UpdateService.StartBackgroundCheck();
			_UsageTrackerService.Track();

			_BroadcastService.BroadcastMessageReceived += BroadcastMessageReceived;
			_BroadcastService.StartListening();

			_Settings.PropertyChanged += (o, e) => {
				                             if (e.PropertyName == ApplicationSize.GetType().Name)
					                             ApplicationSize = _Settings.ApplicationSize;
			                             };
		}
예제 #23
0
        public ShellViewModel(
            Func<HintSession, OverlayViewModel> overlayFactory,
            Func<HintSession, DebugOverlayViewModel> debugOverlayFactory,
            IHintProviderService hintProviderService,
            IDebugHintProviderService debugHintProviderService,
            IWindowManager windowManager,
            Func<OptionsViewModel> optionsVmFactory,
            IKeyListenerService keyListener)
        {
            _overlayFactory = overlayFactory;
            _debugOverlayFactory = debugOverlayFactory;
            _keyListener = keyListener;
            _windowManager = windowManager;
            _hintProviderService = hintProviderService;
            _debugHintProviderService = debugHintProviderService;
            _optionsVmFactory = optionsVmFactory;

            _keyListener.HotKey = new HotKey
            {
                Keys = Keys.OemSemicolon,
                Modifier = KeyModifier.Alt
            };

            #if DEBUG
            _keyListener.DebugHotKey = new HotKey
            {
                Keys = Keys.OemSemicolon,
                Modifier = KeyModifier.Alt | KeyModifier.Shift
            };
            #endif

            _keyListener.OnHotKeyActivated += _keyListener_OnHotKeyActivated;
            _keyListener.OnDebugHotKeyActivated += _keyListener_OnDebugHotKeyActivated;
        }
        public MantenerGuiaDeRemisionViewModel(IWindowManager windowmanager, GuiaRemision g)
            : this(windowmanager)
        {
            if (g.Nota != null)
            {
                Nota = g.Nota;
                Alm = g.Almacen;
            }

            if (g.Orden != null)
            {
                Orden = g.Orden;
                Orden.CodOrden = "OD-" + (1000000 + Orden.IdOrdenDespacho).ToString();
            }

            TxtCodigo = g.CodGuiaRem;
            TxtFechaReg = g.FechaReg;
            SeleccionadoTipo=g.Tipo;
            TxtConductor = g.Conductor;
            SeleccionadoCamion = g.Camion;
            TxtObservaciones = g.Observaciones;

            if (g.Estado == 1)
                TxtEstado = "EMITIDA";
            else
                TxtEstado = "ATENDIDA";

            indicador = 2;
        }
예제 #25
0
        public BuscarZonaViewModel(IWindowManager windowmanager)
        {
            _windowManager = windowmanager;
            Usuario u = new Usuario();
            u = DataObjects.Seguridad.UsuarioSQL.buscarUsuarioPorIdUsuario(Int32.Parse(Thread.CurrentPrincipal.Identity.Name));
            idTienda = u.IdTienda;
            idResponsable = u.IdUsuario;

            TiendaSQL tSQL = new TiendaSQL();
            CmbTiendas = tSQL.BuscarTienda();
            Index = this.CmbTiendas.FindIndex(x => x.IdTienda == idTienda);

            AlmacenSQL aSQL = new AlmacenSQL();
            Almacenes anaquel = aSQL.BuscarAlmacen(-1, idTienda, 2);

            idAnaquel = anaquel.IdAlmacen;

            NumColumns = anaquel.NroColumnas;
            NumRows = anaquel.NroFilas;
            Altura = anaquel.Altura;

            TipoZonaSQL tzSQL = new TipoZonaSQL();
            LstZonasAnq = tzSQL.ObtenerZonasxAlmacen(idAnaquel, 2);
            CmbZonas = lstZonasAnq;
            ProductoSQL pSQL = new ProductoSQL();
            LstProductos = pSQL.BuscarProductoxTienda(idTienda);
        }
예제 #26
0
        public AppViewModel(IWindowManager windowManager)
        {
            _windowManager = windowManager;

            // Init children view models.
            SettingsViewModel = new SettingsViewModel(_windowManager);
        }
예제 #27
0
        public ShellViewModel(IWindowManager window, IEventAggregator events)
        {
            _window = window;
            _events = events;

            DisplayName = "NXT Remote Control";
        }
예제 #28
0
        public NotifyIconViewModel(
            IWindowManager windowManager,
            ISyncThingManager syncThingManager,
            Func<SettingsViewModel> settingsViewModelFactory,
            IProcessStartProvider processStartProvider,
            FileTransfersTrayViewModel fileTransfersViewModel)
        {
            this.windowManager = windowManager;
            this.syncThingManager = syncThingManager;
            this.settingsViewModelFactory = settingsViewModelFactory;
            this.processStartProvider = processStartProvider;
            this.FileTransfersViewModel = fileTransfersViewModel;

            this.syncThingManager.StateChanged += (o, e) =>
            {
                this.SyncThingState = e.NewState;
                if (e.NewState != SyncThingState.Running)
                    this.SyncThingSyncing = false; // Just make sure we reset this...
            };
            this.SyncThingState = this.syncThingManager.State;

            this.syncThingManager.TotalConnectionStatsChanged += (o, e) =>
            {
                var stats = e.TotalConnectionStats;
                this.SyncThingSyncing = stats.InBytesPerSecond > 0 || stats.OutBytesPerSecond > 0;
            };

            this.syncThingManager.DataLoaded += (o, e) =>
            {
                this.Folders = new BindableCollection<FolderViewModel>(this.syncThingManager.Folders.FetchAll()
                    .Select(x => new FolderViewModel(x, this.processStartProvider))
                    .OrderBy(x => x.FolderId));
            };
        }
        public ConsultaProdutoViewModel(IWindowManager windowManager)
        {
            _windowManager = windowManager;
            DisplayName = "Consulta de Produtos";

            Consultar();
        }
예제 #30
0
        public AboutViewModel(
            IWindowManager windowManager,
            ISyncThingManager syncThingManager,
            IConfigurationProvider configurationProvider,
            IUpdateManager updateManager,
            Func<ThirdPartyComponentsViewModel> thirdPartyComponentsViewModelFactory,
            IProcessStartProvider processStartProvider)
        {
            this.windowManager = windowManager;
            this.syncThingManager = syncThingManager;
            this.updateManager = updateManager;
            this.thirdPartyComponentsViewModelFactory = thirdPartyComponentsViewModelFactory;
            this.processStartProvider = processStartProvider;

            this.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(3);
            this.HomepageUrl = Properties.Settings.Default.HomepageUrl;

            this.SyncthingVersion = this.syncThingManager.Version == null ? Resources.AboutView_UnknownVersion : this.syncThingManager.Version.Version;
            this.syncThingManager.DataLoaded += (o, e) =>
            {
                this.SyncthingVersion = this.syncThingManager.Version == null ? Resources.AboutView_UnknownVersion : this.syncThingManager.Version.Version;
            };

            this.CheckForNewerVersionAsync();
        }
예제 #31
0
 public abstract IProgressTask <float, T> LoadWindowAsync <T>(IWindowManager windowManager, string name) where T : Window;
예제 #32
0
        private LayoutInfo DefaultLayout(IWindowManager wm)
        {
            bool isDialog;

            WindowDescriptor sceneWd;
            GameObject       sceneContent;

            wm.CreateWindow(RuntimeWindowType.Scene.ToString(), out sceneWd, out sceneContent, out isDialog);

            WindowDescriptor sceneXWd;
            GameObject       sceneXContent;
            RuntimeWindow    xWindow = wm.CreateWindow(RuntimeWindowType.Scene.ToString(), out sceneXWd, out sceneXContent, out isDialog).GetComponent <RuntimeWindow>();

            // xWindow.CanActivate = false;

            RunNextFrame(() =>
            {
                IScenePivot xPivot    = xWindow.IOCContainer.Resolve <IScenePivot>();
                xPivot.Pivot.position = new Vector3(5, 0, 0);

                xWindow.Camera.transform.position = Vector3.right * 20;
                xWindow.Camera.transform.LookAt(xPivot.Pivot);
                xWindow.Camera.orthographic = true;

                PositionHandle positionHandle = wm.GetComponents(xWindow.transform).SelectMany(c => c.GetComponentsInChildren <PositionHandle>(true)).FirstOrDefault();
                positionHandle.GridSize       = 2;

                RotationHandle rotationHandle = wm.GetComponents(xWindow.transform).SelectMany(c => c.GetComponentsInChildren <RotationHandle>(true)).FirstOrDefault();
                rotationHandle.GridSize       = 5;

                Tab tab = Region.FindTab(xWindow.transform);
                tab.IsCloseButtonVisible = false;
            });

            WindowDescriptor gameWd;
            GameObject       gameContent;

            wm.CreateWindow(RuntimeWindowType.Game.ToString(), out gameWd, out gameContent, out isDialog);

            WindowDescriptor inspectorWd;
            GameObject       inspectorContent;

            wm.CreateWindow(RuntimeWindowType.Inspector.ToString(), out inspectorWd, out inspectorContent, out isDialog);

            WindowDescriptor hierarchyWd;
            GameObject       hierarchyContent;

            wm.CreateWindow(RuntimeWindowType.Hierarchy.ToString(), out hierarchyWd, out hierarchyContent, out isDialog);

            LayoutInfo layout = new LayoutInfo(false,
                                               new LayoutInfo(true,
                                                              new LayoutInfo(
                                                                  new LayoutInfo(sceneContent.transform, sceneWd.Header, sceneWd.Icon),
                                                                  new LayoutInfo(gameContent.transform, gameWd.Header, gameWd.Icon)),
                                                              new LayoutInfo(sceneXContent.transform, sceneXWd.Header, sceneXWd.Icon),
                                                              0.5f),
                                               new LayoutInfo(true,
                                                              new LayoutInfo(inspectorContent.transform, inspectorWd.Header, inspectorWd.Icon),
                                                              new LayoutInfo(hierarchyContent.transform, hierarchyWd.Header, hierarchyWd.Icon),
                                                              0.5f),
                                               0.75f);

            return(layout);
        }
예제 #33
0
        private void OverrideDefaultLayout()
        {
            IWindowManager wm = IOC.Resolve <IWindowManager>();

            wm.OverrideDefaultLayout(DefaultLayout, RuntimeWindowType.Scene.ToString());
        }
예제 #34
0
 public TimelineModule(IUnityContainer container, IRegionManager regionManager, IRegionViewRegistry regionViewRegistry, IWindowManager windowManager)
 {
     this.container          = container;
     this.regionManager      = regionManager;
     this.windowManager      = windowManager;
     this.regionViewRegistry = regionViewRegistry;
 }
 public static void ShowMetroMessageBox(this IWindowManager @this, string message)
 {
     @this.ShowMetroMessageBox(message, "System Message", MessageBoxButton.OK);
 }
예제 #36
0
        private void OverlayPromptToAutofill(AccessibilityNodeInfo root, AccessibilityEvent e)
        {
            if (!AccessibilityHelpers.OverlayPermitted())
            {
                if (!AccessibilityHelpers.IsAutofillTileAdded)
                {
                    // The user has the option of only using the autofill tile and leaving the overlay permission
                    // disabled, so only show this toast if they're using accessibility without overlay permission and
                    // have _not_ added the autofill tile
                    System.Diagnostics.Debug.WriteLine(">>> Overlay Permission not granted");
                    Toast.MakeText(this, AppResources.AccessibilityOverlayPermissionAlert, ToastLength.Long).Show();
                }
                return;
            }

            if (_overlayView != null || _anchorNode != null || _overlayAnchorObserverRunning)
            {
                CancelOverlayPrompt();
            }

            if (Java.Lang.JavaSystem.CurrentTimeMillis() - _lastAutoFillTime < 1000)
            {
                return;
            }

            var uri      = AccessibilityHelpers.GetUri(root);
            var fillable = !string.IsNullOrWhiteSpace(uri);

            if (fillable)
            {
                if (_blacklistedUris != null && _blacklistedUris.Any())
                {
                    if (Uri.TryCreate(uri, UriKind.Absolute, out var parsedUri) && parsedUri.Scheme.StartsWith("http"))
                    {
                        fillable = !_blacklistedUris.Contains(
                            string.Format("{0}://{1}", parsedUri.Scheme, parsedUri.Host));
                    }
                    else
                    {
                        fillable = !_blacklistedUris.Contains(uri);
                    }
                }
            }
            if (!fillable)
            {
                return;
            }

            var intent = new Intent(this, typeof(AccessibilityActivity));

            intent.PutExtra("uri", uri);
            intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop | ActivityFlags.ClearTop);

            _overlayView = AccessibilityHelpers.GetOverlayView(this);
            _overlayView.Measure(View.MeasureSpec.MakeMeasureSpec(0, 0),
                                 View.MeasureSpec.MakeMeasureSpec(0, 0));
            _overlayViewHeight  = _overlayView.MeasuredHeight;
            _overlayView.Click += (sender, eventArgs) =>
            {
                CancelOverlayPrompt();
                StartActivity(intent);
            };

            var layoutParams   = AccessibilityHelpers.GetOverlayLayoutParams();
            var anchorPosition = AccessibilityHelpers.GetOverlayAnchorPosition(e.Source, _overlayViewHeight,
                                                                               _isOverlayAboveAnchor);

            layoutParams.X = anchorPosition.X;
            layoutParams.Y = anchorPosition.Y;

            if (_windowManager == null)
            {
                _windowManager = GetSystemService(WindowService).JavaCast <IWindowManager>();
            }

            _anchorNode  = e.Source;
            _lastAnchorX = anchorPosition.X;
            _lastAnchorY = anchorPosition.Y;

            _windowManager.AddView(_overlayView, layoutParams);

            System.Diagnostics.Debug.WriteLine(">>> Accessibility Overlay View Added at X:{0} Y:{1}",
                                               layoutParams.X, layoutParams.Y);

            StartOverlayAnchorObserver();
        }
예제 #37
0
 public LoginViewModel(IWindowManager manager)
 {
     _manager    = manager;
     DisplayName = "Login form";
 }
예제 #38
0
 public abstract T LoadWindow <T>(IWindowManager windowManager, string name) where T : Window;
예제 #39
0
 public RibbonViewModel(IDaxStudioHost host, IEventAggregator eventAggregator, IWindowManager windowManager, IGlobalOptions options, ISettingProvider settingProvider)
 {
     _eventAggregator = eventAggregator;
     _eventAggregator.Subscribe(this);
     _host           = host;
     _windowManager  = windowManager;
     SettingProvider = settingProvider;
     Options         = options;
     _theme          = Options.Theme;
     UpdateGlobalOptions();
     CanCut              = true;
     CanCopy             = true;
     CanPaste            = true;
     _sqlProfilerCommand = SqlProfilerHelper.GetSqlProfilerLaunchCommand();
     RecentFiles         = SettingProvider.GetFileMRUList();
     InitRunStyles();
 }
예제 #40
0
 public virtual IProgressTask <float, Window> LoadWindowAsync(IWindowManager windowManager, string name)
 {
     return(LoadWindowAsync <Window>(windowManager, name));
 }
 public VariablePickerService(IWindowManager windowManager,
                              IContainerProvider containerProvider)
 {
     this.windowManager     = windowManager;
     this.containerProvider = containerProvider;
 }
예제 #42
0
 public virtual Window LoadWindow(IWindowManager windowManager, string name)
 {
     return(LoadWindow <Window>(windowManager, name));
 }
예제 #43
0
        /// <summary>
        /// 依赖注入构造器
        /// </summary>
        public IndexViewModel(ServiceProxy <IAuthorizationContract> authorizationContract, IWindowManager windowManager)
        {
            this._authorizationContract = authorizationContract;
            this._windowManager         = windowManager;

            //默认值
            this.PageIndex = 1;
            this.PageSize  = 20;
        }
예제 #44
0
 public TriadSchemeEditorViewModel(IWindowManager windowManager)
     : base(windowManager)
 {
 }
 public ShellViewModel(IWindowManager windowManager)
 {
     _windowManager = windowManager;
 }
예제 #46
0
        /// <summary>
        /// Create the service.
        /// </summary>
        public override void OnCreate()
        {
            base.OnCreate();

            // get the window manager, and create it with the attributes so its always around
            _wm = this.GetSystemService(Context.WindowService).JavaCast <IWindowManager>();

            var ps = new WindowManagerLayoutParams(WindowManagerTypes.SystemAlert)
            {
                Flags   = WindowManagerFlags.NotTouchModal | WindowManagerFlags.NotFocusable,
                Format  = Format.Translucent,
                Gravity = GravityFlags.Left | GravityFlags.Top,
                X       = 0,
                Y       = 0,
                Width   = ViewGroup.LayoutParams.MatchParent,
                Height  = ViewGroup.LayoutParams.WrapContent
            };


            // inflate the console view
            var v = this.GetSystemService(Context.LayoutInflaterService).JavaCast <LayoutInflater>();

            _theView = v.Inflate((int)Resource.Layout.overlay, null);

            // find out key buttons and lists
            _restoreButton       = _theView.FindViewById <ImageButton>(Resource.Id.consoleRestoreButton);
            _minimizeButton      = _theView.FindViewById <ImageButton>(Resource.Id.consoleMinimizeButton);
            _minimalLayout       = _theView.FindViewById <LinearLayout>(Resource.Id.consoleMinimizedLayout);
            _restoredLayout      = _theView.FindViewById <FrameLayout>(Resource.Id.consoleExpandedLayout);
            _toolbarLayout       = _theView.FindViewById <RelativeLayout>(Resource.Id.consoleToolbar);
            _logListView         = _theView.FindViewById <ListView>(Resource.Id.consoleLogList);
            _trackActiveButton   = _theView.FindViewById <ImageButton>(Resource.Id.consoleTrackLatestButton);
            _playPauseButton     = _theView.FindViewById <ImageButton>(Resource.Id.consolePlayPauseButton);
            _clearButton         = _theView.FindViewById <ImageButton>(Resource.Id.consoleClearButton);
            _copyClipboardButton = _theView.FindViewById <ImageButton>(Resource.Id.consoleCopyClipboardButton);
            _closeButton         = _theView.FindViewById <ImageButton>(Resource.Id.consoleCloseButton);

            // setup listensers to allow for things to be moved around
            _toolbarLayout.SetOnTouchListener(this);
            _restoreButton.SetOnTouchListener(this);

            // listen to our toolbar buttons.
            _minimizeButton.Click      += MinimizeButtonClick;
            _restoreButton.Click       += RestoreButtonClick;
            _trackActiveButton.Click   += TrackActiveButtonClick;
            _playPauseButton.Click     += PlayPauseButtonClick;
            _clearButton.Click         += ClearButtonClick;
            _copyClipboardButton.Click += CopyClipboardButtonClick;
            _closeButton.Click         += CloseButtonClick;

            // finally add the view.
            _wm.AddView(_theView, ps);


            // host look to observable the logging firehose

            // monitor the fire hose and format to text...
            var diagnosticsSubscriber = Overlay.DiagnosticsSubscriber;

            _adapter             = new RxOverlayLogAdapter(diagnosticsSubscriber.BufferSize);
            _logListView.Adapter = _adapter;

            // and create the subscription which gives us the things to be presented
            _firehoseSub = diagnosticsSubscriber.Entries.Where(_ => _playing).
                           Scan(new OverlayListEntry(0, string.Empty), (e, s) => new OverlayListEntry(e.Index + 1, s)).
                           ObserveOn(RxApp.MainThreadScheduler).
                           Do(s =>
            {
                _adapter.Add(s);
            }).
                           Subscribe(s =>
            {
                if (_trackToActive && _adapter.Count > 0)
                {
                    _logListView.SmoothScrollToPosition(_adapter.Count - 1);
                }
            });
        }
예제 #47
0
 /// <summary>
 /// Initialize a solution editor with existing visualizer binding expressions.
 /// </summary>
 /// <param name="visualizerExpressionItems">Visualizer expression items.</param>
 /// <param name="theWindowManager">The window manager.</param>
 public SolutionEditorViewModel(IEnumerable <VisualizerExpressionItemViewModel> visualizerExpressionItems, IWindowManager theWindowManager)
 {
     _windowManager = theWindowManager;
     Add            = new CommandHandler(AddExpression);
     Edit           = new CommandHandler(EditExpression, CanEditExpression);
     Delete         = new CommandHandler(DeleteExpression, CanDeleteExpression);
     _added         = new List <VisualizerExpressionItemViewModel>();
     _deleted       = new List <int>();
     _updated       = new List <VisualizerExpressionItemViewModel>();
     Items.AddRange(visualizerExpressionItems);
 }
 public LoginViewModel(IWindowManager windowManager)
 {
     _windowManager = windowManager;
 }
예제 #49
0
 public ExecutionLogPackage(IWindowManager windowManager, IExecutionLogController executionLogController, IOptionsController optionsController)
 {
     this.windowManager          = windowManager;
     this.executionLogController = executionLogController;
     this.optionsController      = optionsController;
 }
예제 #50
0
 public PictureSettingsViewModel(IStaticPreviewViewModel staticPreviewViewModel, IWindowManager windowManager)
 {
     this.windowManager          = windowManager;
     this.StaticPreviewViewModel = staticPreviewViewModel;
     this.StaticPreviewViewModel.SetPictureSettingsInstance(this);
     this.sourceResolution = new Size(0, 0);
     this.Task             = new EncodeTask();
     this.PaddingFilter    = new PadFilter(this.Task, () => this.OnFilterChanged(null));
     this.RotateFlipFilter = new RotateFlipFilter(this.Task, e => this.OnFlipRotateChanged(e));
     this.Init();
 }
예제 #51
0
 public OptionsViewModel(IWindowManager windowManager) : base(windowManager)
 {
 }
 public SoloButtonDialogBoxViewModel(IWindowManager wm)
 {
     _wm = wm;
 }
예제 #53
0
 public MainViewModelBuilder WithWindowManager(IWindowManager windowManager)
 {
     _windowManager = windowManager;
     return(this);
 }
예제 #54
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VideoViewModel"/> class.
 /// </summary>
 /// <param name="windowManager">
 /// The window manager.
 /// </param>
 /// <param name="userSettingService">
 /// The user Setting Service.
 /// </param>
 public VideoViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
 {
 }
예제 #55
0
        public SettingsViewModel(
            IConfigurationProvider configurationProvider,
            IAutostartProvider autostartProvider,
            IWindowManager windowManager,
            IProcessStartProvider processStartProvider,
            IAssemblyProvider assemblyProvider,
            IApplicationState applicationState,
            IApplicationPathsProvider applicationPathsProvider,
            ISyncthingManager syncthingManager,
            IMeteredNetworkManager meteredNetworkManager)
        {
            this.configurationProvider    = configurationProvider;
            this.autostartProvider        = autostartProvider;
            this.windowManager            = windowManager;
            this.processStartProvider     = processStartProvider;
            this.assemblyProvider         = assemblyProvider;
            this.applicationState         = applicationState;
            this.applicationPathsProvider = applicationPathsProvider;
            this.syncthingManager         = syncthingManager;

            this.MinimizeToTray      = this.CreateBasicSettingItem(x => x.MinimizeToTray);
            this.NotifyOfNewVersions = this.CreateBasicSettingItem(x => x.NotifyOfNewVersions);
            this.CloseToTray         = this.CreateBasicSettingItem(x => x.CloseToTray);
            this.ObfuscateDeviceIDs  = this.CreateBasicSettingItem(x => x.ObfuscateDeviceIDs);
            this.UseComputerCulture  = this.CreateBasicSettingItem(x => x.UseComputerCulture);
            this.UseComputerCulture.RequiresSyncTrayzorRestart = true;
            this.DisableHardwareRendering = this.CreateBasicSettingItem(x => x.DisableHardwareRendering);
            this.DisableHardwareRendering.RequiresSyncTrayzorRestart = true;
            this.EnableConflictFileMonitoring = this.CreateBasicSettingItem(x => x.EnableConflictFileMonitoring);
            this.EnableFailedTransferAlerts   = this.CreateBasicSettingItem(x => x.EnableFailedTransferAlerts);

            this.PauseDevicesOnMeteredNetworks          = this.CreateBasicSettingItem(x => x.PauseDevicesOnMeteredNetworks);
            this.PauseDevicesOnMeteredNetworksSupported = meteredNetworkManager.IsSupportedByWindows;

            this.ShowTrayIconOnlyOnClose = this.CreateBasicSettingItem(x => x.ShowTrayIconOnlyOnClose);
            this.ShowSynchronizedBalloonEvenIfNothingDownloaded = this.CreateBasicSettingItem(x => x.ShowSynchronizedBalloonEvenIfNothingDownloaded);
            this.ShowDeviceConnectivityBalloons     = this.CreateBasicSettingItem(x => x.ShowDeviceConnectivityBalloons);
            this.ShowDeviceOrFolderRejectedBalloons = this.CreateBasicSettingItem(x => x.ShowDeviceOrFolderRejectedBalloons);

            this.IconAnimationModes = new BindableCollection <LabelledValue <IconAnimationMode> >()
            {
                LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_DataTransferring, Services.Config.IconAnimationMode.DataTransferring),
                LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_Syncing, Services.Config.IconAnimationMode.Syncing),
                LabelledValue.Create(Resources.SettingsView_TrayIconAnimation_Disabled, Services.Config.IconAnimationMode.Disabled),
            };
            this.IconAnimationMode = this.CreateBasicSettingItem(x => x.IconAnimationMode);

            this.StartSyncthingAutomatically = this.CreateBasicSettingItem(x => x.StartSyncthingAutomatically);
            this.SyncthingPriorityLevel      = this.CreateBasicSettingItem(x => x.SyncthingPriorityLevel);
            this.SyncthingPriorityLevel.RequiresSyncthingRestart = true;
            this.SyncthingAddress = this.CreateBasicSettingItem(x => x.SyncthingAddress, new SyncthingAddressValidator());
            this.SyncthingAddress.RequiresSyncthingRestart = true;

            this.CanReadAutostart  = this.autostartProvider.CanRead;
            this.CanWriteAutostart = this.autostartProvider.CanWrite;
            if (this.autostartProvider.CanRead)
            {
                var currentSetup = this.autostartProvider.GetCurrentSetup();
                this.StartOnLogon   = currentSetup.AutoStart;
                this.StartMinimized = currentSetup.StartMinimized;
            }

            this.SyncthingCommandLineFlags = this.CreateBasicSettingItem(
                x => String.Join(" ", x.SyncthingCommandLineFlags),
                (x, v) =>
            {
                IEnumerable <KeyValuePair <string, string> > envVars;
                KeyValueStringParser.TryParse(v, out envVars, mustHaveValue: false);
                x.SyncthingCommandLineFlags = envVars.Select(item => KeyValueStringParser.FormatItem(item.Key, item.Value)).ToList();
            }, new SyncthingCommandLineFlagsValidator());
            this.SyncthingCommandLineFlags.RequiresSyncthingRestart = true;

            this.SyncthingEnvironmentalVariables = this.CreateBasicSettingItem(
                x => KeyValueStringParser.Format(x.SyncthingEnvironmentalVariables),
                (x, v) =>
            {
                IEnumerable <KeyValuePair <string, string> > envVars;
                KeyValueStringParser.TryParse(v, out envVars);
                x.SyncthingEnvironmentalVariables = new EnvironmentalVariableCollection(envVars);
            }, new SyncthingEnvironmentalVariablesValidator());
            this.SyncthingEnvironmentalVariables.RequiresSyncthingRestart = true;

            this.SyncthingCustomHomePath = this.CreateBasicSettingItem(x => x.SyncthingCustomHomePath);
            this.SyncthingCustomHomePath.RequiresSyncthingRestart = true;

            this.SyncthingDenyUpgrade = this.CreateBasicSettingItem(x => x.SyncthingDenyUpgrade);
            this.SyncthingDenyUpgrade.RequiresSyncthingRestart = true;

            var configuration = this.configurationProvider.Load();

            foreach (var settingItem in this.settings)
            {
                settingItem.LoadValue(configuration);
            }

            foreach (var folderSetting in this.FolderSettings)
            {
                folderSetting.Bind(s => s.IsWatched, (o, e) => this.UpdateAreAllFoldersWatched());
                folderSetting.Bind(s => s.IsNotified, (o, e) => this.UpdateAreAllFoldersNotified());
            }

            this.PriorityLevels = new BindableCollection <LabelledValue <SyncthingPriorityLevel> >()
            {
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_AboveNormal, SyncTrayzor.Services.Config.SyncthingPriorityLevel.AboveNormal),
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_Normal, SyncTrayzor.Services.Config.SyncthingPriorityLevel.Normal),
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_BelowNormal, SyncTrayzor.Services.Config.SyncthingPriorityLevel.BelowNormal),
                LabelledValue.Create(Resources.SettingsView_Syncthing_ProcessPriority_Idle, SyncTrayzor.Services.Config.SyncthingPriorityLevel.Idle),
            };

            this.Bind(s => s.AreAllFoldersNotified, (o, e) =>
            {
                if (this.updatingFolderSettings)
                {
                    return;
                }

                this.updatingFolderSettings = true;

                foreach (var folderSetting in this.FolderSettings)
                {
                    folderSetting.IsNotified = e.NewValue.GetValueOrDefault(false);
                }

                this.updatingFolderSettings = false;
            });

            this.Bind(s => s.AreAllFoldersWatched, (o, e) =>
            {
                if (this.updatingFolderSettings)
                {
                    return;
                }

                this.updatingFolderSettings = true;

                foreach (var folderSetting in this.FolderSettings)
                {
                    folderSetting.IsWatched = e.NewValue.GetValueOrDefault(false);
                }

                this.updatingFolderSettings = false;
            });

            this.UpdateAreAllFoldersWatched();
            this.UpdateAreAllFoldersNotified();
        }
예제 #56
0
 public DialogService(IWindowManager windowManager)
 {
     _windowManager = windowManager;
 }
예제 #57
0
 public ConfigViewModel(IWindowManager manager)
 {
     _windowMgr = manager;
     LoadConfigFile();
 }
예제 #58
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="windowManager">WindowManager used to display dialogs.</param>
 public MediaPlayerDatabaseScrobbleViewModel(IWindowManager windowManager)
     : base(windowManager, "Media Player Database Scrobbler")
 {
     ParsedScrobbles = new ObservableCollection <MediaDBScrobbleViewModel>();
 }
예제 #59
0
        public SettingsViewModel(Library library, ViewSettings viewSettings, CoreSettings coreSettings, IWindowManager windowManager, Guid accessToken, MobileApiInfo mobileApiInfo)
        {
            if (library == null)
            {
                throw new ArgumentNullException(nameof(library));
            }

            if (viewSettings == null)
            {
                throw new ArgumentNullException(nameof(viewSettings));
            }

            if (coreSettings == null)
            {
                throw new ArgumentNullException(nameof(coreSettings));
            }

            if (mobileApiInfo == null)
            {
                throw new ArgumentNullException(nameof(mobileApiInfo));
            }

            this.library       = library;
            this.viewSettings  = viewSettings;
            this.coreSettings  = coreSettings;
            this.windowManager = windowManager;
            this.accessToken   = accessToken;

            this.canCreateAdmin = this
                                  .WhenAnyValue(x => x.CreationPassword, x => !string.IsNullOrWhiteSpace(x) && !this.isAdminCreated)
                                  .ToProperty(this, x => x.CanCreateAdmin);

            this.CreateAdminCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.CanCreateAdmin),
                                                             ImmediateScheduler.Instance); // Immediate execution, because we set the password to an empty string afterwards
            this.CreateAdminCommand.Subscribe(p =>
            {
                this.library.LocalAccessControl.SetLocalPassword(this.accessToken, this.CreationPassword);
                this.isAdminCreated = true;
            });

            this.ChangeToPartyCommand = ReactiveCommand.Create(this.CreateAdminCommand.Select(x => true).StartWith(false));
            this.ChangeToPartyCommand.Subscribe(p =>
            {
                this.library.LocalAccessControl.DowngradeLocalAccess(this.accessToken);
                this.ShowSettings = false;
            });

            this.canLogin = this.WhenAnyValue(x => x.LoginPassword, x => !string.IsNullOrWhiteSpace(x))
                            .ToProperty(this, x => x.CanLogin);

            this.LoginCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.CanLogin),
                                                       ImmediateScheduler.Instance); // Immediate execution, because we set the password to an empty string afterwards
            this.LoginCommand.Subscribe(p =>
            {
                try
                {
                    this.library.LocalAccessControl.UpgradeLocalAccess(this.accessToken, this.LoginPassword);
                    this.IsWrongPassword = false;

                    this.ShowLogin    = false;
                    this.ShowSettings = true;
                }

                catch (WrongPasswordException)
                {
                    this.IsWrongPassword = true;
                }
            });

            this.OpenLinkCommand = ReactiveCommand.Create();
            this.OpenLinkCommand.Cast <string>().Subscribe(x =>
            {
                try
                {
                    Process.Start(x);
                }

                catch (Win32Exception ex)
                {
                    this.Log().ErrorException("Could not open link \{x}", ex);
                }
            });
예제 #60
0
 public MenüViewModel(IWindowManager windowManager)
 {
     this.windowManager = windowManager;
 }