private void BtnViewCollection_Click(object sender, RoutedEventArgs e)
        {
            if (sender is Windows.UI.Xaml.Documents.Hyperlink b)
            {
                var t = b.GetFirstAncestorOfType <TextBlock>();
                AddToCollectionResult result = (AddToCollectionResult)t.DataContext;

                MainViewModel main = ResourceHelper.Get <ViewModelLocator>("Locator").Main;

                if (MainPage.MainDispatcher.HasThreadAccess)
                {
                    main.Settings.LastSelectedFontName = result.Font.Name;
                    main.SelectedCollection            = result.Collection;
                }
                else
                {
                    _ = MainPage.MainDispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                    {
                        await WindowService.TrySwitchToWindowAsync(WindowService.MainWindow, true);
                        main.Settings.LastSelectedFontName = result.Font.Name;
                        main.SelectedCollection            = result.Collection;
                    });
                }

                b.GetFirstAncestorOfType <InAppNotification>()?.Dismiss();
            }
        }
Ejemplo n.º 2
0
        private void go_back(object sender, RoutedEventArgs e)
        {
            WindowService winadm = new WindowService(logins);

            this.Close();
            winadm.Show();
        }
Ejemplo n.º 3
0
 public MainWindowViewModel(WindowService service)
 {
     InitializeTestData();
     Service      = service;
     CopyCommand  = new RelayCommand <object>(CopySelectedOptionToClipboad, raw => raw is Option);
     PasteCommand = new RelayCommand <object>(raw => CreateOptionFromClipboard(), raw => true);
 }
Ejemplo n.º 4
0
        public OkWindow(WindowService windowService, string title, string text) : base(title)
        {
            Pad(15);
            PadTop(25);
            GetTitleLabel().FillParent = true;
            GetTitleLabel().SetAlignment(Nez.UI.Align.Center);
            GetTitleLabel().SetFontColor(Color.Black);

            this.windowService = windowService;

            var skin = GameSettings.Skin;

            var table = new Table();

            table.Center();

            var textLbl = new Label(text);

            textLbl.SetFontColor(Color.Black);
            var okBtn = new TextButton("Ok", skin.Get <TextButtonStyle>("Button"));

            okBtn.OnClicked += OkBtn_OnClicked;

            table.Add(textLbl).SetPadBottom(10).SetPadTop(10);
            table.Row();
            table.Add(okBtn);

            Add(table);
        }
Ejemplo n.º 5
0
        //private void App_Startup(object sender, StartupEventArgs e)
        //{

        //}

        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.UnhandledException       += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;

            Configuration configuration = Configuration.Load();

            // Register config
            TinyIoCContainer.Current.Register <IConfiguration, Configuration>(configuration);

            //LanguageService languageService = new LanguageService(confModel);
            //TinyIoCContainer.Current.Register<ILanguageService, LanguageService>(languageService);

            //UndoRedoEngine undoRedoEngine = new UndoRedoEngine();
            //TinyIoCContainer.Current.Register<IUndoRedoEngine, UndoRedoEngine>(undoRedoEngine);

            TinyIoC.TinyIoCContainer.Current.Register <IDataBaseManager, DataBaseManager>().AsMultiInstance();

            var           shell         = new View.MainWindow();
            WindowService windowService = new WindowService(shell);

            //var model = new MainModel();
            //DllModel model = DllModel.LoadSetting();
            var viewModel = new ViewModel.MainViewModel(windowService, configuration);


            shell.DataContext = viewModel;

            shell.Closing += new System.ComponentModel.CancelEventHandler(viewModel.OnClosing);
            shell.Show();

            base.OnStartup(e);
        }
Ejemplo n.º 6
0
 private void OnLogout()
 {
     if (WindowService.ShowMessage($"Do you really want to logout?", "Warning") ?? false)
     {
         ControlPCHelper.LogOut();
     }
 }
Ejemplo n.º 7
0
 public ProfileEditorModel(WindowService windowService, MetroDialogService dialogService, DeviceManager deviceManager, LuaManager luaManager)
 {
     _windowService = windowService;
     _dialogService = dialogService;
     _deviceManager = deviceManager;
     _luaManager    = luaManager;
 }
Ejemplo n.º 8
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Logger.WriteLine("------------------------------------------------------------------------------------------------");
            Logger.Info("Приложение Remf запустилось.");

            var  isLastCrashed = Settings.Default.IsLastCrashed;
            var  savedFilePath = Settings.Default.SavedFilePath;
            bool?result        = true;

            if (isLastCrashed && !string.IsNullOrWhiteSpace(savedFilePath))
            {
                savedFilePath = AddSuffix(savedFilePath, "_afterCrashed");
            }
            else
            {
                result = WindowService.ShowSaveDialog(out savedFilePath);
            }

            if (result ?? false)
            {
                Settings.Default["SavedFilePath"] = savedFilePath;
                Settings.Default.Save();
            }
            else
            {
                Logger.Warn("Пользователь не указал файл сохранения.");
                this.Shutdown(0);
                return;
            }

            WindowService.AddMapping <MainWindowViewModel, MainWindow>();
            WindowService.AddMapping <StepSettingsViewModel, StepSettingsView>();
            WindowService.ShowMainWindow <MainWindowViewModel>();
        }
        public void AddWindow(IntPtr handle)
        {
            WindowService.GetWindowRect(handle, out var rect);
            WindowRectangle windowRectangle = new WindowRectangle(
                new Point(rect.Left, rect.Y),
                rect.Width - rect.X, rect.Height - rect.Y);

            if (!_windows.ContainsKey(handle))
            {
                _windows.Add(handle, windowRectangle);
            }
            else
            {
                _windows[handle] = windowRectangle;
            }

            if (!_profiles.ContainsKey(handle))
            {
                _profiles.Add(handle, new Profile(_user.ApiKey));
            }
            else
            {
                _profiles[handle] = new Profile(_user.ApiKey);
            }

            if (!_errors.ContainsKey(handle))
            {
                _errors.Add(handle, false);
            }
            else
            {
                _errors[handle] = false;
            }
        }
        private void ExecuteStartTraining(bool canEvaluate)
        {
            ((MainWindowVM)Parent).Save();

            var config = GetTestConfiguration();

            ((MainWindowVM)Parent).ExpressionsVisibility = Visibility.Hidden;

            try
            {
                if (_defaultChooser == null)
                {
                    _defaultChooser             = new DefaultExpressionChooser(DateTimeProvider, DataAccess);
                    _flashCardsAlgorithmChooser = new FlashCardsExpressionsChooser(DateTimeProvider, DataAccess);

                    _defaultLearningAlgorithm    = new DefaultLearningAlgorithm(DateTimeProvider);
                    _flashCardsLearningAlgorithm = new FlashCardsLearningAlgorithm();
                }

                WindowService.ShowDialog(
                    new TestVM(
                        canEvaluate,
                        config,
                        FlashCardsAlgorithm ? _flashCardsAlgorithmChooser : _defaultChooser,
                        FlashCardsAlgorithm ? _flashCardsLearningAlgorithm : _defaultLearningAlgorithm));
            }
            catch (Exception ex)
            {
                WindowService.ShowError(ex);
            }

            ((MainWindowVM)Parent).ExpressionsVisibility = Visibility.Visible;
            ((MainWindowVM)Parent).RebuildList();
        }
Ejemplo n.º 11
0
        public virtual void Copy()
        {
            var ii             = new ImageOperator();
            var destinationDir = new DirectoryInfo(ResultPath);
            var dirList        = new List <string>();

            if (UnInstallationFolder)
            {
                dirList.Add("Фото_демонтажа");
            }
            if (InstallationFolder)
            {
                dirList.Add("Фото_монтажа");
            }
            if (ConnectionFolder)
            {
                dirList.Add("Фото_подключения");
            }
            if (RepairsFolder)
            {
                dirList.Add("Фото_ремонта");
            }
            if (LightFolder)
            {
                dirList.Add("Фото_свет");
            }
            WindowService.Hide();
            SplashScreenService.ShowSplashScreen();
            ii.CopyByNumbers(SourceDir, destinationDir, UNIUs, dirList, RenameToSubdirs, CopyToSubdirs, OverlayText);
            SplashScreenService.HideSplashScreen();
            WindowService.Close();
        }
Ejemplo n.º 12
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            SongsViewModel songsViewModel = new SongsViewModel(SongsModel);

            WindowService.Show(songsViewModel);
        }
Ejemplo n.º 13
0
 public override void Initialize()
 {
     Scenes               = CreateSceneHandler();
     Scenes.Window        = WindowService.CreateWindow("test", new Vec2(100, 100), new Vec2(100, 100));
     Scenes.Canvas        = WindowService.CreateCanvas(Scenes.Window);
     Scenes.ContentLoader = WindowService.CreateContentLoader(Scenes.Canvas);
 }
Ejemplo n.º 14
0
        public BackupSelectorViewModel(WindowService windowService, BackupSelectorModel model) : base(windowService, model)
        {
            this.model = model;

            BackupList          = model.BackupList.ToReadOnlyReactiveCollection();
            BackupFileList      = model.BackupFileList.ToReadOnlyReactiveCollection();
            BackupProgressValue = model.ObserveProperty(m => m.BackupProgressValue).ToReactiveProperty();
            ProgressLabel       = model.ObserveProperty(m => m.ProgressLabel).ToReactiveProperty();
            RestoreBtEnabled    = model.ObserveProperty(m => m.CanRestore).ToReactiveProperty();
            ForwardBtIsEnabled  = model.ObserveProperty(m => m.ForwardBtIsEnabled).ToReactiveProperty();
            BackBtIsEnabled     = model.ObserveProperty(m => m.BackBtIsEnabled).ToReactiveProperty();
            PathText            = model.ToReactivePropertyAsSynchronized(m => m.PathText);
            DeleteBtEnabled     = model.ObserveProperty(m => m.CanRestore).ToReactiveProperty();
            DeleteAllBtEnabled  = model.ObserveProperty(m => m.CanDeleteAll).ToReactiveProperty();

            RestoreBtClicked            = new DelegateCommand(RestoreBt_Clicked);
            BackupBtClicked             = new DelegateCommand(BackupBt_Clicked);
            DeleteBtClicked             = new DelegateCommand(DeleteBt_Clicked);
            DeleteAllBtClicked          = new DelegateCommand(DeleteAllBt_Clicked);
            BackupListContextMenuOpened = new DelegateCommand(BackupListContextMenu_Opened);
            BackupListSelectionChanged  = new DelegateCommand <int?>(BackupList_SelectionChanged);
            ForwardBtClicked            = new DelegateCommand(ForwardBt_Clicked);
            BackBtClicked = new DelegateCommand(BackBt_Clicked);
            BackupFileListMouseDoubleClick = new DelegateCommand <PathMapItem>(BackupFileList_MouseDoubleClick);
        }
Ejemplo n.º 15
0
        public void RelocateWindow_Rect_ShouldPassRect()
        {
            // Prepare
            Rect?sendRect = default;

            var winApiServiceMock  = new Mock <IWinApiService>();
            var processServiceMock = new Mock <IProcessService>();

            winApiServiceMock.Setup(x => x.SetWindowPos(It.IsAny <IntPtr>(), It.IsAny <Rect>(), It.IsAny <SwpType>()))
            .Callback <IntPtr, Rect, SwpType>((handle, rect, swpType) => sendRect = rect);

            var windowMock = new Window {
                WindowHandle = (IntPtr)1
            };
            var resolutionMock = new Rect {
                Left = 1, Top = 2, Right = 100, Bottom = 200
            };
            var windowService = new WindowService(winApiServiceMock.Object, processServiceMock.Object);

            // Act
            windowService.RelocateWindow(windowMock, resolutionMock);

            // Assert
            Assert.NotNull(sendRect);
            Assert.Equal(resolutionMock, sendRect);
        }
        public void CmdSetMainExchange()
        {
            try
            {
                //주거래소 설정
                using (RequestArbitrageSetMainExchangeModel req = new RequestArbitrageSetMainExchangeModel())
                {
                    req.userEmail = MainViewModel.LoginDataModel.userEmail;
                    req.exchgeId  = SelExchangeItem.exchgeId;

                    using (ResponseArbitrageSetMainExchangeModel res = WebApiLib.SyncCallEncrypt <ResponseArbitrageSetMainExchangeModel, RequestArbitrageSetMainExchangeModel>(req))
                    {
                        if (res.resultStrCode == "000")
                        {
                            if (res.data.failCd.Equals(""))
                            {
                                alert = new Alert(Localization.Resource.Arbitrage_SetMainExchange_Alert_1);
                                alert.ShowDialog();

                                SelExchangeItem.mainYn = "Y";
                                exchangeList.Where(x => x.exchgeId == SelExchangeItem.exchgeId).FirstOrDefault().mainYn = "Y";

                                WindowService.Close();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
        }
Ejemplo n.º 17
0
    protected override void mapBindings()
    {
        Debug.Log("GlobalContext mapBindings");
        GlobalRoot globalRoot = (contextView as GameObject).GetComponent <GlobalRoot>();

        //Model
        injectionBinder.Bind <WindowModel>().ToSingleton();

        //command
        commandBinder.Bind <StartSignal>().To <GlobalStartCommand>().Once();
        commandBinder.Bind <WindowServiceReadySignal>().To <WindowServiceReadyCommand>().Once();

        //Service
        WindowService windowService = globalRoot.GetComponentInChildren <WindowService>();

        injectionBinder.injector.Inject(windowService);
        injectionBinder.Bind <WindowService>().ToValue(windowService);

        //Signal
        injectionBinder.Bind <ViewInteractSignal>().To <ViewInteractSignal>();

        //View
        mediationBinder.Bind <MainWindow>().To <MainMediator>();
        mediationBinder.Bind <TaskWindow>().To <TaskMediator>();
        mediationBinder.Bind <FightWindow>().To <FightMediator>();
        mediationBinder.Bind <SettingWindow>().To <SettingMediator>();
        mediationBinder.Bind <MsgWindow>().To <MsgMediator>();
    }
Ejemplo n.º 18
0
        private void TryAuthoriseLive(ILiveProvider live)
        {
            if (live.IsAuthorised)
            {
                return;
            }

            WindowService.ShowDialog(new WebLoginVM(this, live.SingInUrl, live.LoginCallback)
            {
                Name = Lbl.LiveLogin
            }, saveSizeAndPosition: true, canResize: true);

            if (!live.IsAuthorised)
            {
                if (!String.IsNullOrEmpty(live.ErrorCode))
                {
                    WindowService.ShowError(String.Format(Msg.CannotAuthorise2, live.ErrorCode));
                }
                else if (!String.IsNullOrEmpty(live.ErrorDescription))
                {
                    WindowService.ShowError(String.Format(Msg.CannotAuthorise2, live.ErrorDescription));
                }
                if (!String.IsNullOrEmpty(live.ErrorCode))
                {
                    WindowService.ShowError(String.Format(Msg.CannotAuthorise));
                }
            }
        }
        public void Hide()
        {
            var factory    = new Mock <IWindowFactory>();
            var controller = new Mock <IWindowController>();

            controller.SetupProperty(x => x.Opacity);

            var obj        = new WindowService();
            var privateObj = new PrivateObject(obj);

            obj.Hide();

            obj.SetWindowFactory(factory.Object);
            obj.Show();

            controller.Raise(x => x.Initialized += null);

            try {
                obj.Hide();
                Assert.Fail();
            } catch (InvalidOperationException) { }

            obj.SetWindowController(controller.Object);

            try {
                obj.Hide();
                Assert.Fail();
            } catch (InvalidOperationException) { }

            controller.Raise(x => x.Initialized += null, new EventArgs());

            obj.Hide();

            Assert.AreEqual(0.0, controller.Object.Opacity);
        }
        private void ExecuteConfirmCreateGraphCommand(object param)
        {
            CreateGraph();

            ExecuteCloseWindowCommand(null);
            WindowService.Adjust(model.Graph);
        }
Ejemplo n.º 21
0
        private void CreateNotifyIcon()
        {
            _icon = new TaskbarIcon {
                IconSource = new BitmapImage(Divvun.Installer.Properties.Constants.TaskbarIcon),
            };
            var menu = new ContextMenu();

            var openPkgMgrItem = new MenuItem {
                Header = Strings.OpenPackageManager
            };

            openPkgMgrItem.Click += (sender, args) => WindowService.Show <MainWindow>();
            menu.Items.Add(openPkgMgrItem);
            menu.Items.Add(new Separator());

            var exitItem = new MenuItem {
                Header = Strings.Exit
            };

            exitItem.Click += (sender, args) => Current.Shutdown();
            menu.Items.Add(exitItem);

            _icon.ContextMenu           = menu;
            _icon.TrayMouseDoubleClick += (sender, args) => WindowService.Show <MainWindow>();
        }
Ejemplo n.º 22
0
        public void TestInitFrameworkElement()
        {
            IWindowService subject = new WindowService(new DummyUnityContainer());


            subject.InitFrameWorkElement("TestUserControl", Assembly.GetExecutingAssembly().GetTypes());
        }
Ejemplo n.º 23
0
 private void OnShutdown()
 {
     if (WindowService.ShowMessage($"Do you really want to shutdown your computer?", "Warning") ?? false)
     {
         ControlPCHelper.ShutdownPC();
     }
 }
Ejemplo n.º 24
0
        private void go_service(object sender, RoutedEventArgs e)
        {
            WindowService main = new WindowService(logins);

            main.Show();
            this.Close();
        }
        public SettingWindowViewModel(WindowService windowService, SettingModel model) : base(windowService, model)
        {
            this.model = model;

            #region Event Initialize
            GetSvFilePathBtClick    = new DelegateCommand(GetSvFilePathBt_Click);
            GetConfFilePathBtClick  = new DelegateCommand(GetConfFilePathBt_Click);
            GetAdminFilePathBtClick = new DelegateCommand(GetAdminFilePathBt_Click);

            KeyEditBtClick = new DelegateCommand(KeyEditBt_Click);

            GetBackupDirBtClick = new DelegateCommand(GetBackupDirBt_Click);

            SaveBtClick = new DelegateCommand(SaveBt_Click);
            #endregion

            #region Property Initialize
            ExeFilePathText    = model.ToReactivePropertyAsSynchronized(m => m.ExeFilePath);
            ConfigFilePathText = model.ToReactivePropertyAsSynchronized(m => m.ConfigFilePath);
            AdminFilePathText  = model.ToReactivePropertyAsSynchronized(m => m.AdminFilePath);

            IsLogGetterChecked = model.ToReactivePropertyAsSynchronized(m => m.IsLogGetter);
            ConsoleLengthText  = model.ToReactivePropertyAsSynchronized(m => m.ConsoleLengthText);

            IsBetaModeChecked   = model.ToReactivePropertyAsSynchronized(m => m.IsBetaMode);
            IsAutoUpdateChecked = model.ToReactivePropertyAsSynchronized(m => m.IsAutoUpdate);
            BackupDirPath       = model.ToReactivePropertyAsSynchronized(m => m.BackupDirPath);
            #endregion
        }
Ejemplo n.º 26
0
 public ComparatorViewModel(IUndoRedoEngine undoRedoEngine, WindowService windowService,
                            IConfigurationModel configuration)
 {
     _undoRedoEngine = undoRedoEngine;
     _windowService  = windowService;
     _configuration  = configuration;
 }
Ejemplo n.º 27
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Create the window service
            var windowService = new WindowService();

            // Create the localizer service
            var localizerService = new LocalizerService();

            // Setup the dependencies
            Core.Core.Setup(collection =>
            {
                // Add services to the service collection
                collection.AddSingleton <IWindowService>(windowService);
                collection.AddSingleton <IChooserDialogsService>(new ChooserDialogsService());
                collection.AddSingleton <IConfigurationService>(new ConfigurationService());
                collection.AddSingleton <ILocalizerService>(localizerService);
            });

            // Setup the default window style in order to set application font
            var type = typeof(System.Windows.Window);

            FrameworkElement.StyleProperty.OverrideMetadata(type, new FrameworkPropertyMetadata
            {
                DefaultValue = FindResource(type)
            });

            // Setup current language based on starting languages in resource dictionaries
            localizerService.ChangeLanguage("en-US");

            // Setup the starting window and page using the window service
            windowService.Open(Core.Window.MainWindow, null);
            Current.MainWindow = windowService.CurrentWindow.UI;
            windowService.ChangePage(Page.Login);
            Current.MainWindow.ShowDialog();
        }
Ejemplo n.º 28
0
 public TaskbarIconViewModel(
     WindowService windowManager,
     IEventAggregator eventAggregator)
 {
     _windowManager   = windowManager;
     _eventAggregator = eventAggregator;
 }
Ejemplo n.º 29
0
 public LoginScene(
     ZoneClientNetPeer zoneClientNetPeer,
     WindowService windowService)
     : base(windowService)
 {
     this.zoneClientNetPeer = zoneClientNetPeer;
     this.windowService     = windowService;
 }
 public void SetUp()
 {
     _authorizationService = A.Fake <IAuthorizationService>();
     _windowFactory        = A.Fake <IWindowFactory>();
     _settingsHelper       = A.Fake <ISettingsHelper>();
     _settingsService      = A.Fake <ISettingsService>();
     _windowService        = new WindowService(_settingsHelper, _settingsService, _authorizationService, _windowFactory);
 }
Ejemplo n.º 31
0
 public MainDesktop(WindowService windowService)
 {
     this.windowService = windowService;
 }