private async Task navigateToRecordingFromNotification(Notification notification) { if ((notification == null) || (notification.Type == NotificationType.BrowsingError) || (notification.Type == NotificationType.FailedRecording)) { return; } await libraryViewModel.Poll(false); if (libraryViewModel.CloudItems != null) { var recording = libraryViewModel.CloudItems.FirstOrDefault(p => p.ID == notification.RecordingID); if (recording != null) { LibraryItem prevCloudItem = libraryViewModel.SelectedCloudItem; CloudItem prevSelectedItem = SelectedItem; SelectedItem = CloudItem.Library; libraryViewModel.SelectedView = (int)LibraryViewMode.Cloud; libraryViewModel.SelectedCloudItem = recording; if (!recording.Equals(prevCloudItem) || (prevSelectedItem != CloudItem.Library)) { Library.ListViewItemSelected.Execute(null); } } } }
public void PutWord(string word, Size wordPlaceSize) { var place = layouter.PutNextRectangle(wordPlaceSize); var item = new CloudItem(word, place); items.Add(item); }
public CloudItem initCloudItem(string msg) { using (var cmd = MySqlDatabase.Connection.CreateCommand()){ StringBuilder sbItem = new StringBuilder(""); StringBuilder sbDate = new StringBuilder(""); int count = msg.IndexOf(',') + 1; CloudItem cloudItem = new CloudItem(); for (int i = 0; i < msg.Length; i++) { if (msg[i] == ',') { for (int j = count; j < msg.Length; j++) { sbDate.Append(msg[j]); } i = msg.Length; } else { sbItem.Append(msg[i]); } } cloudItem.cloudId = (int)cmd.LastInsertedId; cloudItem.name = sbItem.ToString(); cloudItem.date = sbDate.ToString(); return(cloudItem); } }
private static SortedList <string, object> GetItemList(CloudItem item) { var list = new SortedList <string, object>(); if (item == null) { return(list); } PropertyInfo[] properties = item.GetType().GetProperties(); foreach (PropertyInfo pi in properties) { var browsable = pi.GetCustomAttribute <BrowsableAttribute>(); if ((browsable != null) && (!browsable.Browsable)) { continue; } var displayName = pi.GetCustomAttribute <DisplayNameAttribute>(); if (displayName != null) { list.Add(displayName.DisplayName, pi.GetValue(item, null)); } else { list.Add(pi.Name, pi.GetValue(item, null)); } } return(list); }
/// <summary> /// Get Tag Cloud Items From Active Forums SQL /// </summary> /// <param name="iPortalId"> /// The PortalId of the Forums /// </param> /// <param name="iModuleId"> /// The Module Instance of the Active Forums /// </param> /// <returns> /// The Tags /// </returns> public static List <CloudItem> TagCloudActiveForumsTags(int iPortalId, int iModuleId, int tagCount) { // Get Current Forum User var forumUser = new UserController().GetUser(iPortalId, iModuleId); var forumIds = !string.IsNullOrEmpty(forumUser.UserForums) ? forumUser.UserForums : GetForumsForUser( forumUser.UserRoles, iPortalId, iModuleId); List <CloudItem> afTagsList = new List <CloudItem>(); using (IDataReader dr = new Common().TagCloud_Get(iPortalId, iModuleId, forumIds, tagCount)) { while (dr.Read()) { CloudItem item = new CloudItem { Weight = Convert.ToInt32(dr["Priority"]), Text = dr["TagName"].ToString() }; afTagsList.Add(item); } } return(afTagsList); }
private void ExplorerTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { CloudItem item = e.NewValue as CloudItem; if (item != null) { ListView.ItemsSource = GetItemList(item); } }
public void Ctor_ItemContainsGivenFont() { var rect = new Rectangle(new Point(0, 0), new Size(100, 100)); var word = new Word("word", 5); var font = new Font(FontFamily.GenericMonospace, 10, FontStyle.Bold); var item = new CloudItem(rect, word, font); item.Rectangle.Should().BeEquivalentTo(rect); }
public void Add(Game game, CloudAction action) { var item = new CloudItem { Action = action, Date = DateTime.Now, Item = game, State = CloudState.None, }; data.Add(item); }
public async Task <ActionResult> PostCloudItem([FromBody] CloudItem _cloudItem) { await MySqlDatabase.Connection.OpenAsync(); _cloudItem.database = MySqlDatabase; await _cloudItem.InsertAsync(); await MySqlDatabase.Connection.CloseAsync(); return(new OkObjectResult(cloudItem)); }
public void ReturnSameColor(int repeats) { var colorizer = container.Resolve <SolidColorizer>(); var cloudItem = new CloudItem("", new Rectangle(1, 1, 1, 1), SystemFonts.DefaultFont); var brushesList = new List <SolidBrush>(); for (var i = 0; i < repeats; i++) { brushesList.Add(colorizer.GetBrush(cloudItem)); } brushesList.Should().OnlyContain(brush => brush.Color == brushesList.First().Color); }
public void Add <T>(CloudAction action, params T[] items) { for (int i = 0; i < items.Length; i++) { var item = new CloudItem { Action = action, Date = DateTime.Now, Item = items[i], State = CloudState.None, }; data.Add(item); } }
private Font GetSuitableFontFor(CloudItem cloudItem) { var bounds = cloudItem.Bounds; var word = cloudItem.Word; var font = new Font("Arial", 15); var stringSize = graphics.MeasureString(word, font); while (stringSize.Height < bounds.Height && stringSize.Width < bounds.Width) { font = new Font("Arial", font.Size + 1); stringSize = graphics.MeasureString(word, font); } return(new Font("Arial", font.Size - 1)); }
/// <summary> /// Builds the cloud contents. All items in StringCollection_Shown /// are examined to best fit into the user control. If items at the end won't fit /// (their rectangle would be beyond the bottom of the control), the weakest item will /// be found and its index in StringCollection_Shown returned. /// It will then be deleted by the calling function. /// If all items fit, the function returns -1. /// </summary> /// <returns></returns> private int BuildCloud(ref StringItem si) { int j_merker = -1; // calculate mean and standard deviation of the items in the StringCollection_Shown double mean; double stddev = Statistics.StandardDeviation(StringWeightsShown, out mean); int x_start = 0; // x-start position of text int y_start = 0; // y-start position of text int max_height = 0; // max. height of one line of text strings for (int i = 0; i < StringCollection_Shown.Count; i++) { double weight = StringCollection_Shown.Values[i].Occurrence; string text = StringCollection_Shown.Keys[i]; CloudItem ci = new CloudItem(weight); // get the design (= font), depending on the weight ci.Design = GetDesignFromWeight(weight, mean, stddev); // calculate the position and dimension within the cloud Graphics formGraphics = this.CreateGraphics(); SizeF textsize = formGraphics.MeasureString(text, ci.Design.drawFont); formGraphics.Dispose(); // check, if the text item fits at the bottom of the control. // If not, get the weakest item and return it if (y_start + (int)textsize.Height > m_ControlHeight) { j_merker = GetWeakestItem(ref si); return(j_merker); } // check, if 'line end' (= right margin) of control has been reached if (x_start + (int)textsize.Width > m_ControlWidth) { x_start = 0; y_start += max_height; max_height = 0; // now check again, if the text item fits at the bottom of the control. // If not, get the weakest item and return it if (y_start + (int)textsize.Height > m_ControlHeight) { j_merker = GetWeakestItem(ref si); return(j_merker); } } // to get a more dense package, it's sufficient to take the .Height, not .Height + 1 max_height = Math.Max(max_height, (int)textsize.Height); x_start += (int)textsize.Width; } return(j_merker); }
public void CloudListener() { cloudRecognition.ResultDishRecognition((List <DishDataItem> item) => { dishItem = item; if (dishItem.Count > 0) { loading.SetActive(false); cloudItem = CloudItem.DishData; InfoData(notShowName); } }); cloudRecognition.ResultSceneRecognition((List <SceneDataItem> item) => { sceneItem = item; if (sceneItem.Count > 0) { loading.SetActive(false); cloudItem = CloudItem.SceneData; InfoData(notShowName); } }); cloudRecognition.ResultAnimalRecognition((List <CommonDataItem> item) => { commonItem = item; if (commonItem.Count > 0) { loading.SetActive(false); cloudItem = CloudItem.CommonData; InfoData(notShowName); } }); cloudRecognition.ResultCarRecognition((List <CommonDataItem> item) => { commonItem = item; if (commonItem.Count > 0) { loading.SetActive(false); cloudItem = CloudItem.CommonData; InfoData(notShowName); } }); cloudRecognition.ResultPlantRecognition((List <CommonDataItem> item) => { commonItem = item; if (commonItem.Count > 0) { loading.SetActive(false); cloudItem = CloudItem.CommonData; InfoData(notShowName); } }); }
void Step1ChekOnline() { CurrentLogItem = LogPanel.Add("Check Online..."); var message = new CloudMessage(Engine.CloudAction.CheckUpdates); message.Values.Add(CloudKey.ClientVersion, Application.ProductVersion); var item = new CloudItem() { Date = DateTime.Now, Message = message, State = CloudState.None, Retries = 4, }; CheckUpateItem = item; MainForm.Current.CloudPanel.Add(item); }
public void CreatePictureWithRectangles(int amountOfRectangles) { var visualizer = new CloudVisualizer.CloudVisualizer { Settings = DrawSettings.OnlyRectangles }; var items = new CloudItem[amountOfRectangles]; for (var i = 0; i < amountOfRectangles; i++) { items[i] = new CloudItem(null, new Rectangle(0, 0, 10, 10)); } var picture = visualizer.CreatePictureWithItems(items); IsPictureContainsAllLocationPoints(items, picture) .Should().BeTrue(); }
void _Add(CloudAction action, object items, Guid[] checksums) { var message = new CloudMessage(action); // Try to assign list. message.Checksums = checksums; message.UserGames = items as UserGame[]; message.UserDevices = items as UserDevice[]; var item = new CloudItem() { Date = DateTime.Now, Message = message, State = CloudState.None, }; queueTimer.DoActionNow(item); }
/// <summary> /// Copies the items of StringCollection_Shown into CloudCollection. /// The position and dimension of each item will be calculated again and /// inserted to CloudCollection (they are hold by the class CloudItem). /// </summary> private void CopyStringsToCloud() { CloudCollection.Clear(); // calculate mean and standard deviation of the items in the StringCollection_Shown double mean; double stddev = Statistics.StandardDeviation(StringWeightsShown, out mean); int x_start = 0; // x-start position of text int y_start = 0; // y-start position of text int max_height = 0; // max. height of one line of text strings for (int i = 0; i < StringCollection_Shown.Count; i++) { double weight = StringCollection_Shown.Values[i].Occurrence; string text = StringCollection_Shown.Keys[i]; CloudItem ci = new CloudItem(weight); // set the design (= font), depending on the weight ci.Design = GetDesignFromWeight(weight, mean, stddev); // calculate the position within the cloud Graphics formGraphics = this.CreateGraphics(); SizeF textsize = formGraphics.MeasureString(text, ci.Design.drawFont); formGraphics.Dispose(); ci.Position.X = x_start; ci.Position.Y = y_start; ci.Position.Width = (int)textsize.Width; // check, if 'line end' of control has been reached if (x_start + ci.Position.Width > m_ControlWidth) { ci.Position.X = x_start = 0; y_start += max_height; ci.Position.Y = y_start; max_height = 0; } // to get a more dense package, it's sufficient to take the .Height, not .Height + 1 max_height = Math.Max(max_height, (int)textsize.Height); ci.Position.Height = (int)textsize.Height; x_start += ci.Position.Width; // add the text to the cloud to be put out if (!CloudCollection.ContainsKey(text)) { CloudCollection.Add(text, ci); } } }
void Step1ChekOnline() { CurrentLogItem = LogPanel.Add("Check Online..."); var message = new CloudMessage(Engine.CloudAction.CheckUpdates); var ai = new JocysCom.ClassLibrary.Configuration.AssemblyInfo(); message.Values.Add(CloudKey.ClientVersion, ai.Version); var item = new CloudItem() { Date = DateTime.Now, Message = message, State = CloudState.None, Retries = 4, }; CheckUpateItem = item; Global.CloudClient.TasksTimer.DoActionNow(item); }
/// <summary> /// Get Tag Cloud Items From Active Forums Sql /// </summary> /// <param name="iPortalId"> /// The PortalId of the Forums /// </param> /// <param name="iModuleId"> /// The Module Instance of the Active Forums /// </param> /// <returns> /// The Tags /// </returns> public static List <CloudItem> TagCloudActiveForumsTags(int iPortalId, int iModuleId) { List <CloudItem> afTagsList = new List <CloudItem>(); using (IDataReader dr = new Active.Modules.Forums.Data.Common().TagCloud_Get(iPortalId, iModuleId)) { while (dr.Read()) { CloudItem item = new CloudItem { Weight = Convert.ToInt32(dr["Priority"]), Text = dr["TagName"].ToString() }; afTagsList.Add(item); } } return(afTagsList); }
public void Add <T>(CloudAction action, T[] items = null) { BeginInvoke((MethodInvoker) delegate() { var allow = MainForm.Current.OptionsPanel.InternetAutoSaveCheckBox.Checked; if (!allow) { return; } for (int i = 0; i < items.Length; i++) { var item = new CloudItem() { Action = action, Date = DateTime.Now, Item = items[i], State = CloudState.None, }; data.Add(item); } }); }
public override void GetChildrenAsync(Action <IEnumerable <IFile> > callback) { Action action = () => { if (!Utility.IsConnectedToInternet()) { return; } bool isSyncMode = onlineCloud.CheckAndRefreshSubscriptionSyncMode(); if (!onlineCloud.IsSignedIn) { LogHelper.Debug("OnlineFileExplorerDataFactory, Is SignedIn false, return empty list"); } ///Check is cloud root folder is loaded int i = 0; while (i++ < 10) { if (CloudItem.IsNull()) { Thread.Sleep(2 * 1000); } CloudItem = onlineCloud.RootFolder; if (!CloudItem.IsNull()) { break; } } }; action.BeginInvoke((ar) => { action.EndInvoke(ar); base.GetChildrenAsync(callback); }, action); }
public Bitmap CreatePictureWithItems(IList <TagItem> items) { if (items == null) { throw new ArgumentException("Array can't be null"); } if (items.Count == 0) { throw new ArgumentException("Array can't be empty"); } var picture = new Bitmap(pictureSize.Width, pictureSize.Height); using (var graphics = Graphics.FromImage(picture)) { graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.PageUnit = GraphicsUnit.Pixel; graphics.TextRenderingHint = TextRenderingHint.AntiAlias; graphics.Clear(Settings.Color); graphics.TranslateTransform(pictureSize.Width / 2, pictureSize.Height / 2); var cloudItems = new List <CloudItem>(); foreach (var tagItem in items) { var font = new Font(Settings.Font.FontFamily, tagItem.FontSize, Settings.Font.Style); var stringSize = Size.Round(graphics.MeasureString(tagItem.Word, font)); var item = new CloudItem( tagItem.Word, layouter.PutNextRectangle(stringSize), font); cloudItems.Add(item); } CheckResultSize(cloudItems); cloudDrawer.Draw(graphics, cloudItems, Settings); } return(picture); }
public void Add(CloudItem item) { TasksTimer.DoActionNow(item); }
public SolidBrush GetBrush(CloudItem item) { return(new SolidBrush(color)); }
public void InfoData(string name) { isShow = true; info = ""; if (cloudItem == CloudItem.DishData) { for (int i = 0; i < dishItem.Count; i++) { if (dishItem[i].error != null && dishItem[i].error != "") { ErrorShow(dishItem [i].error); break; } info += dishItem [i].name + " : " + dishItem [i].probability + "\n"; if (dishItem [i].name.Contains(name)) { isShow = false; } } } else if (cloudItem == CloudItem.CommonData) { for (int i = 0; i < commonItem.Count; i++) { if (commonItem[i].error != null && commonItem[i].error != "") { ErrorShow(commonItem [i].error); break; } info += commonItem [i].name + " : " + commonItem [i].score + "\n"; if (commonItem [i].name.Contains(name)) { isShow = false; } } } else if (cloudItem == CloudItem.SceneData) { for (int i = 0; i < sceneItem.Count; i++) { if (sceneItem[i].error != null && sceneItem[i].error != "") { ErrorShow(sceneItem [i].error); break; } info += sceneItem [i].keyword + " : " + sceneItem [i].score + "\n"; if (sceneItem [i].keyword.Contains(name)) { isShow = false; } } } text.text = info; if (isShow) { if (!objectTracker.activeSelf) { objectTracker.SetActive(true); } GameObject obj = objectTracker.transform.GetChild(index).gameObject; if (page == imageName && obj.activeSelf) { tracker.StopAR(); obj.transform.position = new Vector3(0, -50f, 1000f); obj.GetComponent <BaiduARObjectTrackable> ().UpdateSlamPos(); tracker.StartAR(); } else { tracker.SetActiveTrack(index); page = imageName; } } cloudItem = CloudItem.None; }