// Use this for initialization void Start() { settings = GetComponent <SettingSaver>(); container = settings.GetSettings(); controller = GetComponent <GASequenceController>(); GeneToggles = GenerateToggles(container.Genes, null, GeneContent, container.SelectedGenes); InitializerGroup = InitializerContent.gameObject.AddComponent <ToggleGroup>(); InitializerToggles = GenerateToggles(container.Initializers, InitializerGroup, InitializerContent, container.SelectedInitializer); FitnessGroup = FitnessContent.gameObject.AddComponent <ToggleGroup>(); FitnessToggles = GenerateToggles(container.FitnessFunctions, FitnessGroup, FitnessContent, container.SelectedFitnessFunction); SelectorGroup = SelectorContent.gameObject.AddComponent <ToggleGroup>(); SelectorToggles = GenerateToggles(container.Selectors, SelectorGroup, SelectorContent, container.SelectedSelector); RecombinerGroup = RecombinerContent.gameObject.AddComponent <ToggleGroup>(); RecombinerToggles = GenerateToggles(container.Recombiners, RecombinerGroup, RecombinerContent, container.SelectedRecombiner); MutatorGroup = MutatorContent.gameObject.AddComponent <ToggleGroup>(); MutatorToggles = GenerateToggles(container.Mutators, MutatorGroup, MutatorContent, container.SelectedMutator); TerminatorGroup = TerminatorContent.gameObject.AddComponent <ToggleGroup>(); TerminatorToggles = GenerateToggles(container.Terminators, TerminatorGroup, TerminatorContent, container.SelectedTerminator); CarInstancesBG.text = container.CarInstances.ToString(); GenerationSizeBG.text = container.GenerationSize.ToString(); SequenceLengthBG.text = container.SequenceLength.ToString(); GeneDurationBG.text = container.GeneDuration.ToString(); TargetLocation = MenuMover.position; OriginalLocation = MenuMover.position; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (this.Frame.CanGoForward) { ForwardButton.IsEnabled = true; } else { ForwardButton.IsEnabled = false; } if (e.NavigationMode != NavigationMode.New) { string sessionState = await SettingSaver.GetSettingFromFile(GlobalConstants.sesstionState); session = Serializer.DeserializeFromString <Session>(sessionState); } else { session = Serializer.DeserializeFromString <Session>(e.Parameter as string); } if (session == null) { return; } gridView.ItemsSource = session.Tickets; base.OnNavigatedTo(e); }
public override void OK() { if (_isOKProcessing) { return; } _isOKProcessing = true; SettingSaver.Save(Controls); Settings.LoadSettings(); Core.ResourceAP.RunJob(new UpdateDefaultsDelegate(UpdateDefaults), _oldUpdateFrequency, _oldUpdatePeriod); if (_chkShowDesktopAlert.Checked != _wasDesktopAlertChecked) { if (_chkShowDesktopAlert.Checked) { Core.ResourceAP.RunJob(new MethodInvoker(CreateDesktopAlertRule)); } else { Core.ResourceAP.RunJob(new MethodInvoker(DeleteDesktopAlertRule)); } } CookiesManager.SetUserCookieProviderName(typeof(RSSUnitOfWork), _cookieProviderSelector.SelectedProfileName); _isOKProcessing = false; WriteFontCharacteristics(); WriteItemFormattingOptions(); Core.SettingStore.WriteBool("NewspaperView()", "AllowHoverSelection", _checkNewspaperAllowHoverSelection.Checked); Core.SettingStore.WriteBool(IniKeys.Section, IniKeys.PropagateFavIconToItems, _checkPropagateFavIconToItems.Checked); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override async void OnNavigatedTo(NavigationEventArgs e) { HardwareButtons.BackPressed += HardwareButtons_BackPressed; if (e.NavigationMode != NavigationMode.New) { string sessionState = await SettingSaver.GetSettingFromFile(GlobalConstants.sesstionState); Session = Serializer.DeserializeFromString <Session>(sessionState); } else { Session = Serializer.DeserializeFromString <Session>(e.Parameter as string); } this.mainGrid.Resources.GetPropertyHolder("sessionMode").Value = Session.Mode; if (Session.Mode == AppLogic.Enums.QuestionsGenerationMode.ExamTicket) { questionsCanvas.ManipulationMode = ManipulationModes.TranslateY; btnEndSession.Visibility = Windows.UI.Xaml.Visibility.Collapsed; } if (Session.Mode == AppLogic.Enums.QuestionsGenerationMode.Questions) { btnEndSession.Content = "Главное меню"; } else { btnEndSession.Content = "Завершить экзамен"; } int index = 0; var questions = Session.Tickets.SelectMany(ticket => ticket.Questions); var length = questions.Count(); questionsCanvas.DataSource = new VirtualLinkedList <IQuestion>(questions, (dataSource, current) => { if (index + 1 < length) { index++; } else { index = 0; } return(dataSource.ElementAt(index)); }, (dataSource, current) => { if (index > 0) { index--; } else { index = length - 1; } return(dataSource.ElementAt(index)); }); }
public async Task CanSaveSettingToFile() { string inputString = "test"; await SettingSaver.SaveSettingToFile("TestSetting", inputString); string outputString = await SettingSaver.GetSettingFromFile("TestSetting"); Assert.IsNotNull(outputString, "out == null"); Assert.AreEqual(inputString, outputString, "in != out"); }
public override void OK() { SettingSaver.Save(Controls); Settings.LoadSettings(); if (Settings.OutlookFolders != null) { Settings.OutlookFolders.UpdateNodeFilter(true); } WriteFontCharacteristics(); }
public void CanSaveSettingToContainer() { string inputString = "test"; SettingSaver.SaveSetting("TestSetting", inputString); string outputString = SettingSaver.GetSetting("TestSetting"); Assert.IsNotNull(outputString, "out == null"); Assert.AreEqual(inputString, outputString, "in != out"); }
public override void OK() { if (!_deliverNewsBox.Checked) { _deliverNewsPeriod.Value = 0; _deliverNewsPeriod.Changed = true; } SettingSaver.Save(Controls); Settings.LoadSettings(); WriteFontCharacteristics(); }
public override void OK() { _chkDownloadPeriod.Checked = _chkDownloadPeriod.Checked && _edtStartDownload.TimeParseable() && _edtFinishDownload.TimeParseable(); Settings.EnclosureDownloadStartHour.Save(_edtStartDownload.Value); Settings.EnclosureDownloadFinishHour.Save(_edtFinishDownload.Value); Settings.EnclosurePath.Save(_browseForFolderControl.SelectedPath); SettingSaver.Save(Controls); Settings.LoadSettings(); Core.ResourceAP.QueueJob(new UpdateDefaultsDelegate(UpdateDefaults), _oldUpdateFrequency, _oldUpdatePeriod); EnclosureDownloadManager.DownloadNextEnclosure(); }
/// <summary> /// Вызывается при приостановке выполнения приложения. Состояние приложения сохраняется /// без учета информации о том, будет ли оно завершено или возобновлено с неизменным /// содержимым памяти. /// </summary> /// <param name="sender">Источник запроса приостановки.</param> /// <param name="e">Сведения о запросе приостановки.</param> private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); // TODO: Сохранить состояние приложения и остановить все фоновые операции try { await SettingSaver.SaveSettingToFile("NavigationState", (Window.Current.Content as Frame).GetNavigationState()); } catch (Exception) { } finally { deferral.Complete(); } }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override async void OnNavigatedTo(NavigationEventArgs e) { HardwareButtons.BackPressed += HardwareButtons_BackPressed; if (e.NavigationMode != NavigationMode.New) { string sessionState = await SettingSaver.GetSettingFromFile(GlobalConstants.sesstionState); session = Serializer.DeserializeFromString <Session>(sessionState); } else { session = Serializer.DeserializeFromString <Session>(e.Parameter as string); } ISessionStatistics statistics; var creationResult = SessionStatisticsFactory.CreateSessionStatistics(session, out statistics); gridResults.DataContext = statistics; }
private void OnSaveFeedImpl() { foreach (IResource feed in _feeds) { feed.BeginUpdate(); } if (!_chkAuthentication.Checked) { _edtUserName.Text = string.Empty; _edtPassword.Text = string.Empty; } _needUpdate = _needUpdate || _udUpdateFrequency.Changed || _cmbUpdatePeriod.Changed; if (!_chkUpdate.Checked) { _cmbUpdatePeriod.SetValue("daily"); _cmbUpdatePeriod.Changed = true; _udUpdateFrequency.Minimum = -1; _udUpdateFrequency.SetValue(-1); _udUpdateFrequency.Changed = true; } SettingSaver.Save(Controls); if (_feeds.Count == 1) { _feed.SetProp(Props.URL, _edtAddress.Text); _feed.SetProp(Core.Props.Name, _edtTitle.Text); _feed.SetProp(Core.Props.Annotation, _edtAnnotation.Text); } foreach (IResource feed in _feeds) { feed.EndUpdate(); } if (_needUpdate) { foreach (IResource feed in _feeds) { RSSPlugin.GetInstance().QueueFeedUpdate(feed); } } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { if (this.Frame.CanGoBack) { BackButton.IsEnabled = true; } else { BackButton.IsEnabled = false; } if (this.Frame.CanGoForward) { ForwardButton.IsEnabled = true; } else { ForwardButton.IsEnabled = false; } if (e.NavigationMode != NavigationMode.New) { string sessionState = await SettingSaver.GetSettingFromFile(GlobalConstants.sesstionState); session = Serializer.DeserializeFromString <Session>(sessionState); } else { session = Serializer.DeserializeFromString <Session>(e.Parameter as string); } pagedCanvas = flipping_canvas.Children.OfType <PagedCanvas>().Single(); PagedCollection <IQuestion> paged_col = new PagedCollection <IQuestion>(2); paged_col.DataSource = session.Tickets.SelectMany(ticket => ticket.Questions); pagedCanvas.ItemsSource = paged_col; appbarText.ItemsSource = new ObservableCollection <ISession> { session }; base.OnNavigatedTo(e); }
public override void OK() { // Workaround of OM-13897, calling an OutlookSession in the shutdown // state causes unpredictable results. if (Core.State == CoreState.Running) { _treeView.SaveCheckedState(); MAPIIDs IDs = OutlookSession.GetInboxIDs(); if (IDs != null) { IResource folder = Folder.Find(IDs.EntryID); if (folder != null && !Folder.IsIgnored(folder)) { Core.UIManager.CreateShortcutToResource(folder); } } SettingSaver.Save(Controls); Settings.LoadSettings(); } }
private void OnStart(object sender, System.EventArgs e) { SettingSaver.Save(Controls); Settings.LoadSettings(); string path = RegUtil.GetValue(Registry.LocalMachine, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE", "") as string; if (path == null) { path = "Outlook.exe"; } _process = new Process(); _process.StartInfo.FileName = path; if (Settings.ProcessWindowStyle == "Hidden") { _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; } else { _process.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; } _process.StartInfo.UseShellExecute = Settings.UseShellExecuteForOutlook; _process.Start(); _mainWnd = GenericWindow.FindWindow("rctrl_renwnd32", null); int begin = Environment.TickCount; Tracer._Trace("Waiting while main window is loaded"); while ((int)_mainWnd == 0 && (Environment.TickCount - begin) < 3000) { _mainWnd = GenericWindow.FindWindow("rctrl_renwnd32", null); } Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_ACTIVATEAPP, (IntPtr)1, IntPtr.Zero); Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_NCACTIVATE, (IntPtr)0x200001, IntPtr.Zero); Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_ACTIVATE, (IntPtr)0x200001, IntPtr.Zero); Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_ACTIVATETOPLEVEL, (IntPtr)0x200001, (IntPtr)0x13FBE8); Win32Declarations.SendMessage(_mainWnd, Win32Declarations.WM_SETFOCUS, IntPtr.Zero, IntPtr.Zero); _close.Enabled = true; }
/// <summary> /// Вызывается при обычном запуске приложения пользователем. Будут использоваться другие точки входа, /// если приложение запускается для открытия конкретного файла, отображения /// результатов поиска и т. д. /// </summary> /// <param name="e">Сведения о запросе и обработке запуска.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Не повторяйте инициализацию приложения, если в окне уже имеется содержимое, // только обеспечьте активность окна if (rootFrame == null) { // Создание фрейма, который станет контекстом навигации, и переход к первой странице rootFrame = new Frame(); // TODO: Измените это значение на размер кэша, подходящий для вашего приложения rootFrame.CacheSize = 1; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: Загрузить состояние из ранее приостановленного приложения string navigationState = await SettingSaver.GetSettingFromFile("NavigationState"); if (!String.IsNullOrEmpty(navigationState)) { rootFrame.SetNavigationState(navigationState); } else { rootFrame.Navigate(typeof(MainPage)); } } // Размещение фрейма в текущем окне Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { #if WINDOWS_PHONE_APP // Удаляет турникетную навигацию для запуска. if (rootFrame.ContentTransitions != null) { this.transitions = new TransitionCollection(); foreach (var c in rootFrame.ContentTransitions) { this.transitions.Add(c); } } rootFrame.ContentTransitions = null; rootFrame.Navigated += this.RootFrame_FirstNavigated; #endif // Если стек навигации не восстанавливается для перехода к первой странице, // настройка новой страницы путем передачи необходимой информации в качестве параметра // навигации if (!rootFrame.Navigate(typeof(MainPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } // Обеспечение активности текущего окна Window.Current.Activate(); }
protected override async void OnNavigatedFrom(NavigationEventArgs e) { await SettingSaver.SaveSettingToFile(GlobalConstants.sesstionState, Serializer.SerializeToString(session)); }
private void OnOK(object sender, System.EventArgs e) { SettingSaver.Save(Controls); RefreshSetting(); }
public override void OK() { _treeView.Save(); SettingSaver.Save(Controls); Settings.LoadSettings(); }
protected override async void OnNavigatedFrom(NavigationEventArgs e) { HardwareButtons.BackPressed -= HardwareButtons_BackPressed; await SettingSaver.SaveSettingToFile(GlobalConstants.sesstionState, Serializer.SerializeToString(Session)); }