/// <summary> /// Function:Set current library group. /// Author:Jerry /// Crate DateTime:2008-7-7 /// </summary> /// <param name="pName">string:LibraryGroupName</param> public static bool AddLibraryGroup(string pName) { bool flag = false; if (pName != string.Empty) { LibraryGroup group = Project.LibraryGroups.GetByName(pName); if (group != null) { LibraryGroup.Current = group; flag = true; } else { flag = Provider.Get().LibraryGroups.Add(new LibraryGroup(pName)); LibraryGroup.Current = Provider.Get().LibraryGroups.GetByName(pName); } if (flag) { Update(); } } return(flag); }
private void populateLookup(string libraryGrpName) { LibraryGroup list = LibraryGroup.Current; if (list == null) { return; } }
private void cmdOpenFile_ItemClick(object sender, ItemClickEventArgs e) { dsTree.TreeRow row = (uxWhere.Properties.TreeList.GetDataRecordByNode(uxWhere.Properties.TreeList.FocusedNode) as DataRowView).Row as dsTree.TreeRow; LibraryGroup group = row.Data as LibraryGroup; LibraryFile file = row.Data as LibraryFile; if (file != null) { OpenPresentation(file.FullPath); } }
private void Filter() { uxWhat.Properties.Buttons[(int)WhatButtons.Search].Enabled = false; Regex regEx = new Regex(uxWhat.Tag == null ? uxWhat.Text : "", RegexOptions.IgnoreCase); dsTree.TreeRow row = treeTable.FindByID((int)uxWhere.EditValue); var list = LibraryData.GetAllItems(); int n = list.Count(); if (row.ParentID == -1) { list = list.Where(item => regEx.IsMatch(item.Keywords) ); } else if (row.Data is LibraryFile) { LibraryFile file = row.Data as LibraryFile; list = list.Where(item => item.File.Group.Name == file.Group.Name && item.File.Name == file.Name && regEx.IsMatch(item.Keywords) ); } else { LibraryGroup group = row.Data as LibraryGroup; if (group != null) { list = list.Where(item => item.File.Group.FullPath == group.FullPath && regEx.IsMatch(item.Keywords) ); } else { list = Enumerable.Empty <IFileItem>(); } } uxImagesView.DataSource = list.ToList(); }
protected bool Rename(string newName, string oldName, ShapeType type) { if (string.IsNullOrEmpty(newName) || newName == oldName) { return(false); } LibraryGroup group = LibraryGroup.Current; if (group == null) { return(false); } T item = GetByName(oldName); if (item == null) { return(false); } string newFile = LibraryDir + newName; if (!IOHelper.RenameFile(newFile, item.Path)) { return(false); } item.Name = newName; item.Path = newFile; if (group.Messages != null) { List <IFileHandle> handles = group.Messages.GetFileHandle(item.Id, type); foreach (var h in handles) { h.FileUrl = item.Path; } } MessageBus.Send(this, new FileLibraryRenameMessage(item)); return(true); }
/// <summary> /// get library by appointment customer fields /// </summary> /// <param name="appointment"></param> /// <returns></returns> private static MemoryLibraryItem GetLibrary(Appointment appointment) { //if (appointment.CustomFields.Count == 0) // return null; MemoryLibraryItem item = null; try { LibraryType type = EnumHelper.Parse <LibraryType>(appointment.Description.Replace(" ", "")); LibraryGroup libraryGroup = LibraryGroup.Current; string name = appointment.Subject; if (string.IsNullOrEmpty(name)) { return(null); } switch (type) { case LibraryType.Message: item = libraryGroup.Messages.GetByName(name); break; case LibraryType.Playlist: item = libraryGroup.Playlists.GetByName(name); break; case LibraryType.TimeSliceGroup: item = libraryGroup.TimeSliceGroups.GetByName(name); break; } } catch (Exception ex) { _log.Error(ex.Message, ex); } return(item); }
public SelectLibraryPage(string apiKey, string pref, string city, string jsonResponseLibrary) { try { systemIdLibraryTable = LibraryGroup.getSystemIDLibraryTable(jsonResponseLibrary); List <LibraryGroup> libraryGropuList = LibraryGroup.GetLibraryGroupList(systemIdLibraryTable); ListView listView = new ListView { ItemTemplate = new DataTemplate(typeof(LibraryCell)),//セルの指定 ItemsSource = libraryGropuList, HasUnevenRows = true, }; // Define a selected handler for the ListView. listView.ItemSelected += async(sender, args) => { if (args.SelectedItem == null) { return; } ((ListView)sender).SelectedItem = null; var item = (LibraryGroup)args.SelectedItem; CheckTargetLibrarys targetLibrarys = new CheckTargetLibrarys(); if (item.IsRegist) { item.UpdateStatus(false); //DBから図書館を削除 targetLibrarys.DelLibrary(item.SystemName); } else { const int MAX_LIBRARY_NUM = 5; if (targetLibrarys.Librarys.Count() >= MAX_LIBRARY_NUM) { await DisplayAlert("図書館の登録", "6件以上は登録できません", "OK"); return; } //GA-> //図書館を仮想的に利用して膨大な蔵書を育てる人が多い事の検証。図書館追加することを検証する int libraryNum = targetLibrarys.Librarys.Count() + 1; GoogleAnalytics.Current.Tracker.SendEvent("SelectLibraryPage", "AddLibrary", libraryNum.ToString()); //GA<- item.UpdateStatus(true); //図書館をDBに登録する foreach (var keyValuePair in systemIdLibraryTable) { if (keyValuePair.Key == item.SystemName) { var library = keyValuePair.Value.First(); targetLibrarys.AddLibrary(library.systemid, library.systemname); } } } }; this.Content = listView; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } }