public async void BindFromAzure() { try { syncIndicator.IsRunning = true; memberDatabase = new MemberDatabase(); // var members = memberDatabase.GetMembers(); var sb = await manager1.GetTodoItemsAsync(); // var a = sb.Count(); // var b = members.Count(); TextContainer.Clear(); foreach (TodoItem var2 in sb) { if (var2.Message.StartsWith("blobimage")) { int index = var2.Message.IndexOf("blobimage"); var img1 = var2.Message.Substring(index + 9); var imagestore2 = img1 + ".jpg"; var images = DependencyService.Get <IFileService>().GetPictureFromDisk(imagestore2, getGalleryPath()); TextContainer.Add(new MessageText { imgsource = images, imgheight = "200", imgwidth = "200", Status = var2.Status }); var last3 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); } else if (var2.Message.StartsWith("pdf")) { int index = var2.Message.IndexOf("pdf"); var img1 = var2.Message.Substring(index + 3); var imagestore2 = img1 + ".pdf"; var pdffile = DependencyService.Get <IFileService>().GetPictureFromDisk(imagestore2, getGalleryPath()); // TextContainer.Add(new MessageText { imgsource = images, imgheight = "200", imgwidth = "200", Status = var2.Status }); TextContainer.Add(new MessageText { Text = pdffile, imgheight = "10", imgwidth = "10", Status = var2.Status }); var last3 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); } else { TextContainer.Add(new MessageText { Text = var2.Message, imgheight = "10", imgwidth = "10", Status = var2.Status }); var last3 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); } } syncIndicator.IsRunning = false; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); syncIndicator.IsRunning = false; } }
private bool removeCharacterOrSelection(bool sound = true) { if (Current.Disabled) { return(false); } if (text.Length == 0) { return(false); } if (selectionLength == 0 && selectionLeft == 0) { return(false); } int count = Math.Clamp(selectionLength, 1, text.Length); int start = Math.Clamp(selectionLength > 0 ? selectionLeft : selectionLeft - 1, 0, text.Length - count); if (count == 0) { return(false); } if (sound) { audio.Samples.Get(@"Keyboard/key-delete")?.Play(); } foreach (var d in TextFlow.Children.Skip(start).Take(count).ToArray()) //ToArray since we are removing items from the children in this block. { TextFlow.Remove(d); TextContainer.Add(d); // account for potentially altered height of textbox d.Y = TextFlow.BoundingBox.Y; d.Hide(); d.Expire(); } text = text.Remove(start, count); if (selectionLength > 0) { selectionStart = selectionEnd = selectionLeft; } else { selectionStart = selectionEnd = selectionLeft - 1; } cursorAndLayout.Invalidate(); return(true); }
public FooterButtonRandom() { TextContainer.Add(secondaryText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = @"rewind", Alpha = 0 }); }
private void setTextAsync(string text) { textFlow?.Expire(); TextContainer.Add(textFlow = new OsuTextFlowContainer(s => s.Font = s.Font.With(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Colour = Color4.White.Opacity(0.75f), Text = text }); }
public ChatScreen() { InitializeComponent(); BindingContext = this; SignalRClient.Start(); SignalRClient.OnMessageReceived += (username, message) => { TextContainer.Add(new MessageText { Text = username + ":" + message }); }; }
public FooterButtonRandom() { TextContainer.Add(secondaryText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = @"rewind", Alpha = 0, }); // force both text sprites to always be present to avoid width flickering while they're being swapped out SpriteText.AlwaysPresent = secondaryText.AlwaysPresent = true; }
/// <summary> /// Removes a specified <paramref name="number"/> of characters left side of the current position. /// </summary> /// <remarks> /// If a selection persists, <see cref="removeSelection"/> must be called instead. /// </remarks> /// <returns>A string of the removed characters.</returns> private string removeCharacters(int number = 1) { if (Current.Disabled || text.Length == 0) { return(string.Empty); } int removeStart = Math.Clamp(selectionRight - number, 0, selectionRight); int removeCount = selectionRight - removeStart; if (removeCount == 0) { return(string.Empty); } Debug.Assert(selectionLength == 0 || removeCount == selectionLength); foreach (var d in TextFlow.Children.Skip(removeStart).Take(removeCount).ToArray()) //ToArray since we are removing items from the children in this block. { TextFlow.Remove(d); TextContainer.Add(d); // account for potentially altered height of textbox d.Y = TextFlow.BoundingBox.Y; d.Hide(); d.Expire(); } var removedText = text.Substring(removeStart, removeCount); text = text.Remove(removeStart, removeCount); // Reorder characters depth after removal to avoid ordering issues with newly added characters. for (int i = removeStart; i < TextFlow.Count; i++) { TextFlow.ChangeChildDepth(TextFlow[i], getDepthForCharacterIndex(i)); } selectionStart = selectionEnd = removeStart; cursorAndLayout.Invalidate(); return(removedText); }
private void setSingerAsync(Singer[] singers) { textFlow?.Expire(); TextContainer.Add(textFlow = new FillFlowContainer <SingerSpriteText> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(10), Colour = Color4.White.Opacity(0.75f), }); foreach (var singer in singers) { textFlow.Add(new SingerSpriteText { Singer = singer }); } }
private void load(OsuColour colours) { SelectedColour = colours.Green; DeselectedColour = SelectedColour.Opacity(0.5f); Text = @"random"; Action = () => { if (rewindSearch) { const double fade_time = 500; OsuSpriteText rewindSpriteText; TextContainer.Add(rewindSpriteText = new OsuSpriteText { Alpha = 0, Text = @"rewind", AlwaysPresent = true, // make sure the button is sized large enough to always show this Anchor = Anchor.Centre, Origin = Anchor.Centre, }); rewindSpriteText.FadeOutFromOne(fade_time, Easing.In); rewindSpriteText.MoveTo(Vector2.Zero).MoveTo(new Vector2(0, 10), fade_time, Easing.In); rewindSpriteText.Expire(); SpriteText.FadeInFromZero(fade_time, Easing.In); PreviousRandom.Invoke(); } else { NextRandom.Invoke(); } }; }
public DraggableStateTracker(int number) : base(number) { TextContainer.Add(dragStatus = new SmallText()); }
private void load(OsuColour colours) { SelectedColour = colours.Green; DeselectedColour = SelectedColour.Opacity(0.5f); TextContainer.Add(persistentText = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, AlwaysPresent = true, AutoSizeAxes = Axes.Both, Children = new[] { randomSpriteText = new OsuSpriteText { AlwaysPresent = true, Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "random", }, rewindSpriteText = new OsuSpriteText { AlwaysPresent = true, Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "rewind", Alpha = 0f, } } }); Action = () => { if (rewindSearch) { const double fade_time = 500; OsuSpriteText fallingRewind; TextContainer.Add(fallingRewind = new OsuSpriteText { Alpha = 0, Text = rewindSpriteText.Text, AlwaysPresent = true, // make sure the button is sized large enough to always show this Anchor = Anchor.Centre, Origin = Anchor.Centre, }); fallingRewind.FadeOutFromOne(fade_time, Easing.In); fallingRewind.MoveTo(Vector2.Zero).MoveTo(new Vector2(0, 10), fade_time, Easing.In); fallingRewind.Expire(); persistentText.FadeInFromZero(fade_time, Easing.In); PreviousRandom.Invoke(); } else { NextRandom.Invoke(); } }; }
public async void BindFromAWS() { try { var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Plugin.Permissions.Abstractions.Permission.Storage); if (status != Plugin.Permissions.Abstractions.PermissionStatus.Granted) { if (await CrossPermissions.Current.ShouldShowRequestPermissionRationaleAsync(Plugin.Permissions.Abstractions.Permission.Storage)) { await DisplayAlert("Need location", "Gunna need that Storage", "OK"); } var results = await CrossPermissions.Current.RequestPermissionsAsync(Plugin.Permissions.Abstractions.Permission.Storage); //Best practice to always check that the key exists if (results.ContainsKey(Plugin.Permissions.Abstractions.Permission.Storage)) { status = results[Plugin.Permissions.Abstractions.Permission.Storage]; } } if (status == PermissionStatus.Granted) { string Inputs = "QueryId=" + QueryId + "&StoreUID=" + Storeuid; string resp = await RestService.GetChat(Inputs); var result = Newtonsoft.Json.JsonConvert.DeserializeObject <string>(resp); if (result != "") { try { string[] arrSepr2 = result.Split('|'); if (arrSepr2.Length > 0) { // TextContainer.Clear(); foreach (string word in arrSepr2) { string[] Itemstemp = word.Split('`'); if (Itemstemp[4] == "Text") { TextContainer.Add(new MessageText { Text = Itemstemp[2], imgheight = "10", imgwidth = "10", Status = Itemstemp[6], CustomerChatName = Itemstemp[8], StoreNameMessage = UserNameSentMessage, DateSent = DateTime.Parse(Itemstemp[9]) }); //var last3 = ListView.ItemsSource.Cast<object>().LastOrDefault(); //ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); // await Task.Delay(TimeSpan.FromSeconds(.05)); } else if (Itemstemp[4] == "IMG") { // string images = "https://maudit.elixirct.net/UploadFileToServer/Uploads/" + Itemstemp[2]; var images = DependencyService.Get <IFileService>().GetPictureFromDisk(Itemstemp[2], getGalleryPath()); ExistenceCheckResult imagepresent = await FileSystem.Current.LocalStorage.CheckExistsAsync(images); if (imagepresent == ExistenceCheckResult.FileExists) { TextContainer.Add(new MessageText { imgsource = images, imgheight = "200", imgwidth = "200", Status = Itemstemp[6], DateSent = DateTime.Parse(Itemstemp[9]), CustomerChatName = Itemstemp[8], StoreNameMessage = UserNameSentMessage }); var last4 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last4, ScrollToPosition.MakeVisible, true); } else { //ImageSource.FromUri(new System.Uri(url)) string imagename = Itemstemp[2]; string url = "http://elixirct.in/ShopRConservicePublish/Uploads/" + imagename; try { DependencyService.Get <IFileService>().DownloadFile(url, getGalleryPath()); await Task.Delay(TimeSpan.FromSeconds(2)); var images3 = DependencyService.Get <IFileService>().GetPictureFromDisk(imagename, getGalleryPath()); TextContainer.Add(new MessageText { imgsource = images3, imgheight = "200", imgwidth = "200", Status = Itemstemp[6], DateSent = DateTime.Parse(Itemstemp[9]), CustomerChatName = Itemstemp[8], StoreNameMessage = UserNameSentMessage }); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } // TextContainer.Add(new MessageText { imgsource = images3, imgheight = "200", imgwidth = "200", Status = Itemstemp[6], DateSent = DateTime.Parse(Itemstemp[9]), CustomerChatName = Itemstemp[8], StoreNameMessage = UserNameSentMessage }); // var client = new HttpClient(); // var uri = new Uri(Uri.EscapeUriString(url)); // byte[] urlContents = await client.GetByteArrayAsync(uri); // var stream1 = new MemoryStream(urlContents); // IncidentImageData.Source = ImageSource.FromStream(() => stream1); //await Task.Run(() => // { // TextContainer.Add(new MessageText { imgsource = ImageSource.FromStream(()=>new MemoryStream(urlContents) ) , imgheight = "200", imgwidth = "200", Status = Itemstemp[6], DateSent = DateTime.Parse(Itemstemp[9]), CustomerChatName = Itemstemp[8], StoreNameMessage = UserNameSentMessage }); // // For simplicity setting data on the adapter is omitted here // }); //try //{ // DependencyService.Get<IFileService>().DownloadFile(url, getGalleryPath()); //} //catch (Exception ex) //{ System.Diagnostics.Debug.WriteLine(ex); } // await Task.Delay(100); // await Task.Delay(TimeSpan.FromSeconds(5)); var last7 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last7, ScrollToPosition.MakeVisible, false); } // await Task.Delay(TimeSpan.FromSeconds(1)); } // TextContainer.Add(new MessageText { Id = Itemstemp[0], Dt = Itemstemp[3], Name = Itemstemp[1] + " " + Itemstemp[2] + " " + Itemstemp[4], CustomerName = Itemstemp[5] }); // await Task.Delay(TimeSpan.FromSeconds(1)); } var last6 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last6, ScrollToPosition.MakeVisible, false); } var last5 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last5, ScrollToPosition.MakeVisible, false); } catch (Exception ex) { //System.Diagnostics.Debug.WriteLine(ex); var last5 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last5, ScrollToPosition.MakeVisible, false); } } } else if (status != PermissionStatus.Unknown) { await DisplayAlert("Storage Denied", "Can not continue, try again.", "OK"); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } }
public void BindData() { try { memberDatabase = new MemberDatabase(); var members = memberDatabase.GetMembers(QueryId); foreach (Member var1 in members) { if (var1.Type == "IMG") { var text = var1.Text; //int index = text.IndexOf("awsimage"); //text = text.Substring(index + 8); var images = DependencyService.Get <IFileService>().GetPictureFromDisk(text, getGalleryPath()); TextContainer.Add(new MessageText { imgsource = images, imgheight = "200", imgwidth = "200", Status = var1.Status, DateSent = var1.Datetime }); var last3 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); } else if (var1.Text.StartsWith("pdf")) { int index = var1.Text.IndexOf("pdf"); var img1 = var1.Text.Substring(index + 3); var imagestore2 = img1 + ".pdf"; var images = DependencyService.Get <IFileService>().GetPictureFromDisk(imagestore2, getGalleryPath()); // TextContainer.Add(new MessageText { imgsource = images, imgheight = "200", imgwidth = "200", Status = var1.Status, DateSent = var1.Datetime }); TextContainer.Add(new MessageText { Text = images, imgheight = "10", imgwidth = "10", Status = var1.Status, DateSent = var1.Datetime }); var last3 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); } else { TextContainer.Add(new MessageText { Text = var1.Text, imgheight = "10", imgwidth = "10", Status = var1.Status, DateSent = var1.Datetime }); var last3 = ListView.ItemsSource.Cast <object>().LastOrDefault(); ListView.ScrollTo(last3, ScrollToPosition.MakeVisible, false); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); } //memberDatabase = new MemberDatabase(); //// var members = memberDatabase.GetMembers(); //var sb = manager1.GetTodoItemsAsync().Result; //var a = sb.Count(); //// var b = members.Count(); //if (a > 0) //{ // foreach (TodoItem var2 in sb) // { // // TextContainer.Add(new MessageText { Text = var2.Message, imgheight = "10", imgwidth = "10", Status = var2.Status }); // member = new Member(); // memberDatabase = new MemberDatabase(); // member.Text = var2.Message; // member.Status = var2.Status; // member.Datetime = DateTime.Now; // member.Query_ID = var2.QueryID; // // member.imagesqlite = System.Convert.ToByte(imlocal); // memberDatabase.AddMember(member); // } // } }