private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { if (Clipboard.ContainsText()) { foreach (Description f in DescriptionContainer.LoadString(Clipboard.GetText()).Descriptions) { list.Add(f); } fill(); } } catch (Exception) { if (Clipboard.ContainsText()) { string[] elms = Clipboard.GetText().Split('\n'); for (int i = 0; i < elms.Length; i++) { string s = elms[i]; string trim = s.Trim(new char[] { '\n', '\t', ' ', '\r' }); if (trim.Length == 0) { continue; } if (!s.Contains(".") && i < elms.Length - 1) { int next = i + 1; StringBuilder desc = new StringBuilder(); while (next < elms.Length && (elms[next].Contains(".") || elms[next].Trim(new char[] { '\n', '\t', ' ', '\r' }).Length == 0)) { if (elms[next].Trim(new char[] { '\n', '\t', ' ', '\r' }).Length > 0) { desc.AppendLine(elms[next].Trim(new char[] { '\n', '\t', ' ', '\r' })); } next++; } list.Add(new Description(trim, desc.ToString())); i = next - 1; } else { string[] ss = s.Split(new char[] { '.' }, 2); list.Add(new Description(ss[0].Trim(new char[] { '\n', '\t', ' ', '\r' }), ss.Length > 1 ? ss[1].Trim(new char[] { '\n', '\t', ' ', '\r' }) : null)); } } fill(); } } }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { try { if (Clipboard.ContainsText()) { foreach (Description f in DescriptionContainer.LoadString(Clipboard.GetText()).Descriptions) { list.Add(f); } fill(); } } catch (Exception) { } }
private async Task SelectSample(SampleInfo selectedSample) { if (selectedSample == null) { return; } SampleTitleBlock.Text = selectedSample.SampleName; SampleManager.Current.SelectedSample = selectedSample; DescriptionContainer.SetSample(selectedSample); ShowSampleTab(); // Call a function to clear any existing credentials from AuthenticationManager ClearCredentials(); try { if (selectedSample.OfflineDataItems != null) { CancellationTokenSource cancellationSource = new CancellationTokenSource(); // Show waiting page SampleContainer.Content = new WPF.Viewer.WaitPage(cancellationSource); // Wait for offline data to complete await DataManager.EnsureSampleDataPresent(selectedSample, cancellationSource.Token); } // Show the sample SampleContainer.Content = SampleManager.Current.SampleToControl(selectedSample); SourceCodeContainer.LoadSourceCode(); } catch (OperationCanceledException) { CategoriesRegion.Visibility = Visibility.Visible; SampleContainer.Visibility = Visibility.Collapsed; return; } catch (Exception exception) { // failed to create new instance of the sample SampleContainer.Content = new WPF.Viewer.ErrorPage(exception); } CategoriesRegion.Visibility = Visibility.Collapsed; SampleContainer.Visibility = Visibility.Visible; }
private void Paste_Clicked(object sender, EventArgs e) { try { Changed = true; foreach (Description d in DescriptionContainer.LoadString(DependencyService.Get <IClipboardService>().GetTextData()).Descriptions) { if (d is ListDescription td) { foreach (Names f in td.Names) { Desc.Names.Add(f); } } } Fill(); } catch (Exception ex) { DisplayAlert("Error", ex.Message, "Ok"); } }
protected override void OnPrefabInit() { base.OnPrefabInit(); statusItemPanel = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false); statusItemPanel.Content.GetComponent <VerticalLayoutGroup>().padding.bottom = 10; statusItemPanel.HeaderLabel.text = UI.DETAILTABS.SIMPLEINFO.GROUPNAME_STATUS; statusItemPanel.scalerMask.hoverLock = true; statusItemsFolder = statusItemPanel.Content.gameObject; vitalsPanel = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false); vitalsPanel.SetTitle(UI.DETAILTABS.SIMPLEINFO.GROUPNAME_CONDITION); vitalsContainer = Util.KInstantiateUI(VitalsPanelTemplate, vitalsPanel.Content.gameObject, false).GetComponent <MinionVitalsPanel>(); fertilityPanel = Util.KInstantiateUI <CollapsibleDetailContentPanel>(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false); fertilityPanel.SetTitle(UI.DETAILTABS.SIMPLEINFO.GROUPNAME_FERTILITY); infoPanel = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false); infoPanel.GetComponent <CollapsibleDetailContentPanel>().HeaderLabel.text = UI.DETAILTABS.SIMPLEINFO.GROUPNAME_DESCRIPTION; GameObject gameObject = infoPanel.GetComponent <CollapsibleDetailContentPanel>().Content.gameObject; descriptionContainer = Util.KInstantiateUI <DescriptionContainer>(DescriptionContainerTemplate, gameObject, false); storagePanel = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false); stressPanel = Util.KInstantiateUI(ScreenPrefabs.Instance.CollapsableContentPanel, base.gameObject, false); stressDrawer = new DetailsPanelDrawer(attributesLabelTemplate, stressPanel.GetComponent <CollapsibleDetailContentPanel>().Content.gameObject); stampContainer = Util.KInstantiateUI(StampContainerTemplate, gameObject, false); Subscribe(-1514841199, OnRefreshDataDelegate); }
private async Task SelectSample(SampleInfo selectedSample) { if (selectedSample == null) { return; } // The following code removes the API key when using the Create and save map sample. if (nameof(SampleManager.Current.SelectedSample) != nameof(selectedSample)) { // Remove API key if opening Create and save map sample. if (selectedSample.FormalName == "AuthorMap") { ApiKeyManager.DisableKey(); } // Restore API key if leaving Create and save map sample. else if (SampleManager.Current?.SelectedSample?.FormalName == "AuthorMap") { ApiKeyManager.EnableKey(); } } SampleTitleBlock.Text = selectedSample.SampleName; SampleManager.Current.SelectedSample = selectedSample; DescriptionContainer.SetSample(selectedSample); ShowSampleTab(); // Call a function to clear any existing credentials from AuthenticationManager ClearCredentials(); try { if (selectedSample.OfflineDataItems != null) { CancellationTokenSource cancellationSource = new CancellationTokenSource(); // Show waiting page SampleContainer.Content = new WPF.Viewer.WaitPage(cancellationSource); // Wait for offline data to complete await DataManager.EnsureSampleDataPresent(selectedSample, cancellationSource.Token); } // Show the sample SampleContainer.Content = SampleManager.Current.SampleToControl(selectedSample); SourceCodeContainer.LoadSourceCode(); } catch (OperationCanceledException) { CategoriesRegion.Visibility = Visibility.Visible; SampleContainer.Visibility = Visibility.Collapsed; return; } catch (Exception exception) { // failed to create new instance of the sample SampleContainer.Content = new WPF.Viewer.ErrorPage(exception); } CategoriesRegion.Visibility = Visibility.Collapsed; SampleContainer.Visibility = Visibility.Visible; }