public HandleGuidMenuItem(ITsiGuidItem item, bool isShellExItem) : base(AppString.Menu.HandleGuid) { this.Item = item; this.DropDownItems.Add(TsiCopyGuid); if (isShellExItem) { this.DropDownItems.Add(new ToolStripSeparator()); this.DropDownItems.Add(TsiBlockGuid); } this.DropDownItems.Add(new ToolStripSeparator()); this.DropDownItems.Add(TsiAddGuidDic); TsiCopyGuid.Click += (sender, e) => CopyGuid(); TsiBlockGuid.Click += (sender, e) => BlockGuid(); TsiAddGuidDic.Click += (sender, e) => AddGuidDic(); MyListItem listItem = (MyListItem)item; listItem.ImageDoubleClick += (sender, e) => AddGuidDic(); listItem.TextDoubleClick += (sender, e) => AddGuidDic(); listItem.ContextMenuStrip.Opening += (sender, e) => { TsiBlockGuid.Checked = false; foreach (string path in GuidBlockedList.BlockedPaths) { if (Microsoft.Win32.Registry.GetValue(path, Item.Guid.ToString("B"), null) != null) { TsiBlockGuid.Checked = true; break; } } }; }
/// <summary> /// Gets the values from entity. /// </summary> /// <param name="entityDictionary">The entity dictionary containing property name <see cref="StorageItem" pairs./>.</param> internal void GetValuesFromEntity(Dictionary <string, StorageItem> entityDictionary) { ITrackOriginalValues _entity = (ITrackOriginalValues)this.TEntityGetter; foreach (var _ovx in _entity.OriginalValues) { StorageItem _storage = entityDictionary[_ovx.Key]; object _value = _storage.Storage.GetValue(_entity); if (_storage.Association) { Debug.Assert(_storage.IsLookup, "Unexpected MultivalueType in the GetValuesFromEntity. Expected is lookup, but the filde is reverse lookup"); _value = ((IEntityRef)_value).GetLookup(m_DataContext, ((AssociationAttribute)_storage.Description).List); } else if (((ColumnAttribute)_storage.Description).FieldType.Contains("Choice")) { Dictionary <string, string> _values = new Dictionary <string, string>(); Type _type = StorageItem.GetEnumValues(_storage, _values, true); _value = _values[_value.ToString()]; } MyListItem[_storage.Description.Name] = _value; } MyListItem.Update(); _entity.OriginalValues.Clear(); EntityState = EntityState.Unchanged; }
public HandleGuidMenuItem(ITsiGuidItem item) : base(AppString.Menu.HandleGuid) { this.Item = item; this.DropDownItems.AddRange(new ToolStripItem[] { TsiAddGuidDic, new ToolStripSeparator(), TsiCopyGuid }); if (item is ShellExItem shellExItem) { this.DropDownItems.AddRange(new ToolStripItem[] { TsiBlockGuid, TsiClsidLocation }); shellExItem.ContextMenuStrip.Opening += (sender, e) => TsiClsidLocation.Visible = shellExItem.ClsidPath != null; TsiClsidLocation.Click += (sender, e) => ExternalProgram.JumpRegEdit(shellExItem.ClsidPath); } TsiCopyGuid.Click += (sender, e) => CopyGuid(); TsiBlockGuid.Click += (sender, e) => BlockGuid(); TsiAddGuidDic.Click += (sender, e) => AddGuidDic(); MyListItem listItem = (MyListItem)item; listItem.ImageDoubleClick += (sender, e) => AddGuidDic(); listItem.TextDoubleClick += (sender, e) => AddGuidDic(); listItem.ContextMenuStrip.Opening += (sender, e) => { TsiBlockGuid.Checked = false; foreach (string path in GuidBlockedList.BlockedPaths) { if (Microsoft.Win32.Registry.GetValue(path, Item.Guid.ToString("B"), null) != null) { TsiBlockGuid.Checked = true; break; } } }; }
private void HoveredToShowItemPath() { foreach (Control ctr in MainBody.Controls) { if (ctr is MyList list && list != appSettingBox) { list.HoveredItemChanged += (sender, e) => { if (!AppConfig.ShowFilePath) { return; } MyListItem item = list.HoveredItem; foreach (string prop in new[] { "ItemFilePath", "RegPath", "GroupPath", "SelectedPath" }) { string path = item.GetType().GetProperty(prop)?.GetValue(item, null)?.ToString(); if (!path.IsNullOrWhiteSpace()) { StatusBar.Text = path; return; } } StatusBar.Text = item.Text; }; } } }
public void MoveItem(MyListItem item, bool isUp) { int index = this.GetItemIndex(item); MyListItem otherItem = null; if (isUp) { if (index > 1) { otherItem = (MyListItem)this.Controls[index - 1]; this.SetItemIndex(item, index - 1); } } else { if (index < this.Controls.Count - 1) { otherItem = (MyListItem)this.Controls[index + 1]; this.SetItemIndex(item, index + 1); } } if (otherItem != null) { string path1 = GetItemRegPath(item); string path2 = GetItemRegPath(otherItem); string tempPath = ObjectPath.GetNewPathWithIndex(path1, ObjectPath.PathType.Registry); RegistryEx.MoveTo(path1, tempPath); RegistryEx.MoveTo(path2, path1); RegistryEx.MoveTo(tempPath, path2); SetItemRegPath(item, path2); SetItemRegPath(otherItem, path1); } }
public ChangeTextMenuItem(ITsiTextItem item) : base(AppString.Menu.ChangeText) { this.Click += (sender, e) => { string name = ChangeText(item.Text); if (name != null) { item.ItemText = name; } }; MyListItem listItem = (MyListItem)item; listItem.TextDoubleClick += (sender, e) => { if (listItem is IFoldGroupItem) { return; } if (listItem.FindForm() is ShellStoreDialog.ShellStoreForm) { return; } if (this.Enabled) { this.OnClick(null); } }; }
public MyListItem addFileToList(MyTreeNode versionNode) { // In case of Fusion files we'll be downloading f3z var postFix = versionNode.isFusionFile() ? ".f3z" : "." + versionNode.fileType; // Get relative folder path that we need to recreate on the // local storage side var relPath = ""; MyTreeNode node = versionNode; do { node = (MyTreeNode)node.Parent; relPath = "\\" + removeIllegalFilenameCharacters(node.Text) + relPath; } while (nodeToDownload != node); relPath = relPath.Replace(new string(kUpdateChar, 1), ""); // Add file extrension if needed if (postFix != "." && !relPath.EndsWith(postFix) && !relPath.EndsWith(postFix.ToUpper())) { relPath += postFix; } // Create list item var item = new MyListItem(versionNode, tbxBackupFolder.Text + relPath); ListViewItem lvItem = ltvFiles.Items.Add(item); lvItem.SubItems.Add(item.fileState.ToString()); return(item); }
private void btnNewSubListItem_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Button newSubListItemButton = (Button)sender; MyListItem currentListItem = (MyListItem)newSubListItemButton.Tag; currentListItem.MySubListItems.Add(new MySubListItem()); }
public ChangeIconMenuItem(ITsiIconItem item) : base(AppString.Menu.ChangeIcon) { this.Click += (sender, e) => { using (IconDialog dlg = new IconDialog()) { dlg.IconPath = item.IconPath; dlg.IconIndex = item.IconIndex; if (dlg.ShowDialog() != DialogResult.OK) { return; } item.IconPath = dlg.IconPath; item.IconIndex = dlg.IconIndex; item.IconLocation = $"{dlg.IconPath},{dlg.IconIndex}"; using (Icon icon = ResourceIcon.GetIcon(dlg.IconPath, dlg.IconIndex)) { item.Image = icon.ToBitmap(); } } }; MyListItem listItem = (MyListItem)item; listItem.Disposed += (sender, e) => item.ItemIcon?.Dispose(); listItem.ImageDoubleClick += (sender, e) => { if (this.Enabled) { this.OnClick(null); } }; }
public VisibleCheckBox(IChkVisibleItem item) { MyListItem listItem = (MyListItem)item; listItem.AddCtr(this); this.CheckChanged += () => item.ItemVisible = this.Checked; listItem.ParentChanged += (sender, e) => { if (listItem.IsDisposed) { return; } if (listItem.Parent == null) { return; } this.Checked = item.ItemVisible; if (listItem is FoldSubItem subItem && subItem.FoldGroupItem != null) { return; } if (listItem.FindForm() is ShellStoreDialog.ShellStoreForm) { return; } if (AppConfig.HideDisabledItems) { listItem.Visible = this.Checked; } }; }
private void DeleteItem(MyListItem item) { int index = this.GetItemIndex(item); this.Controls.Remove(item); this.Controls[index - 1].Focus(); this.SubKeyNames.RemoveAt(index - 1); this.SaveSorting(); item.Dispose(); }
private static void RemoveItem(CommonMultiItemsList list, MyListItem item) { int index = list.GetItemIndex(item); list.Controls.Remove(item); list.Controls[index - 1].Focus(); list.SubKeyNames.RemoveAt(index - 1); list.WriteRegistry(); item.Dispose(); }
public IActionResult AddList(MyList list) { String sessionList = HttpContext.Session.GetString("currentList"); MyList currentList = null; if (!String.IsNullOrWhiteSpace(sessionList)) { currentList = JsonConvert.DeserializeObject <MyList>(sessionList); } String formAction = list.userAction; if (null != list && !String.IsNullOrWhiteSpace(list.listName)) { if ("ADD".Equals(formAction)) { String newItemAdded = list.newItem; MyListItem listItem = new MyListItem(); listItem.itemName = newItemAdded; if (null != currentList) { currentList.listName = list.listName; currentList.description = list.description; list = currentList; } if (null == list.listItems) { list.listItems = new List <MyListItem>(); } list.listItems.Add(listItem); } else if ("REMOVE".Equals(formAction)) { String removeItemName = list.listItemToRemove; if (null != currentList) { currentList.listName = list.listName; currentList.description = list.description; list = currentList; } MyListItem itemToRemove = null; foreach (MyListItem item in list.listItems) { if (item.itemName.Equals(removeItemName)) { itemToRemove = item; break; } } list.listItems.Remove(itemToRemove); } HttpContext.Session.SetString("currentList", JsonConvert.SerializeObject(list)); } return(View(list)); }
public Form1() { InitializeComponent(); MyListItem item1 = new MyListItem("Java", 1); MyListItem item2 = new MyListItem("C#", 221); MyListItem item3 = new MyListItem("C++", 13); listBox1.Items.Add(item1); listBox1.Items.Add(item2); listBox1.Items.Add(item3); }
public DeleteButton(IBtnDeleteItem item) : base(AppImage.Delete) { MyListItem listItem = (MyListItem)item; listItem.AddCtr(this); this.MouseDown += (sender, e) => { if (AppMessageBox.Show(AppString.Message.ConfirmDelete, MessageBoxButtons.YesNo) == DialogResult.Yes) { item.DeleteMe(); } }; }
/// <summary> /// Gets the values from entity. /// </summary> /// <param name="entityDictionary">The entity dictionary containing property name <see cref="StorageItem"/>pairs..</param> internal void GetValuesFromEntity(Dictionary <string, StorageItem> entityDictionary) { ITrackOriginalValues _entity = (ITrackOriginalValues)this.TEntityGetter; foreach (var _ovx in _entity.OriginalValues) { StorageItem _storage = entityDictionary[_ovx.Key]; _storage.GetValueFromEntity(_entity, (name, value) => MyListItem[name] = value); } MyListItem.Update(); _entity.OriginalValues.Clear(); EntityState = EntityState.Unchanged; }
private void AddNewItem() { MyListItem newItem = new MyListItem { Text = AppString.Item.AddGuidBlockedItem, Image = AppImage.AddNewItem }; PictureButton btnAddNewItem = new PictureButton(AppImage.AddNewItem); newItem.AddCtr(btnAddNewItem); newItem.SetNoClickEvent(); this.AddItem(newItem); MyToolTip.SetToolTip(btnAddNewItem, newItem.Text); btnAddNewItem.MouseDown += (sender, e) => { using (InputDialog dlg = new InputDialog { Title = AppString.Dialog.InputGuid }) { if (GuidEx.TryParse(Clipboard.GetText(), out Guid guid)) { dlg.Text = guid.ToString(); } if (dlg.ShowDialog() != DialogResult.OK) { return; } if (GuidEx.TryParse(dlg.Text, out guid)) { Array.ForEach(GuidBlockedItem.BlockedPaths, path => { Registry.SetValue(path, guid.ToString("B"), string.Empty); }); for (int i = 1; i < Controls.Count; i++) { if (((GuidBlockedItem)Controls[i]).Guid.Equals(guid)) { MessageBoxEx.Show(AppString.MessageBox.HasBeenAdded); return; } } this.InsertItem(new GuidBlockedItem(dlg.Text), 1); ExplorerRestarter.NeedRestart = true; } else { MessageBoxEx.Show(AppString.MessageBox.MalformedGuid); } } }; }
private void AddDirItem() { MyListItem item = new MyListItem { Text = Path.GetFileNameWithoutExtension(SendToPath), Image = ResourceIcon.GetFolderIcon(SendToPath).ToBitmap() }; PictureButton btnPath = new PictureButton(AppImage.Open); MyToolTip.SetToolTip(btnPath, AppString.Menu.FileLocation); btnPath.MouseDown += (sender, e) => ExternalProgram.JumpExplorer(SendToPath); item.AddCtr(btnPath); this.InsertItem(item, 1); }
private void setItemState(MyListItem item, DownloadState state) { if (treeView.InvokeRequired) { treeView.Invoke(new DelegateSetItemState(this.setItemState), new Object[] { item, state }); } else { item.fileState = state; ListViewItem.ListViewSubItem subItem = item.SubItems[1]; subItem.Text = state.ToString(); subItem.BackColor = downloadStateToColor[state]; } }
private void AddGuidDic() { using (AddGuidDicDialog dlg = new AddGuidDicDialog()) { dlg.ItemText = GuidInfo.GetText(Item.Guid); dlg.ItemIcon = GuidInfo.GetImage(Item.Guid); var location = GuidInfo.GetIconLocation(Item.Guid); dlg.ItemIconPath = location.IconPath; dlg.ItemIconIndex = location.IconIndex; IniWriter writer = new IniWriter { FilePath = AppConfig.UserGuidInfosDic, DeleteFileWhenEmpty = true }; string section = Item.Guid.ToString(); MyListItem listItem = (MyListItem)Item; if (dlg.ShowDialog() != DialogResult.OK) { if (dlg.IsDelete) { writer.DeleteSection(section); GuidInfo.RemoveDic(Item.Guid); listItem.Text = Item.ItemText; listItem.Image = GuidInfo.GetImage(Item.Guid); } return; } if (dlg.ItemText.IsNullOrWhiteSpace()) { AppMessageBox.Show(AppString.Message.TextCannotBeEmpty); return; } dlg.ItemText = ResourceString.GetDirectString(dlg.ItemText); if (dlg.ItemText.IsNullOrWhiteSpace()) { AppMessageBox.Show(AppString.Message.StringParsingFailed); return; } else { GuidInfo.RemoveDic(Item.Guid); writer.SetValue(section, "Text", dlg.ItemText); writer.SetValue(section, "Icon", dlg.ItemIconLocation); listItem.Text = dlg.ItemText; listItem.Image = dlg.ItemIcon; } } }
private void SubListItems_Drop(object sender, Windows.UI.Xaml.DragEventArgs e) { MyListItem sourceList = null; MyListItem destinationList = null; MySubListItem movingItem = null; //The item that's being dragged object item; if (e.Data.Properties.TryGetValue("sourceItem", out item)) { movingItem = (MySubListItem)item; } //Source List object source; if (e.Data.Properties.TryGetValue("sourceList", out source)) { sourceList = (MyListItem)source; } //Destination List object destination; if (e.Data.Properties.TryGetValue("destinationList", out destination)) { destinationList = (MyListItem)destination; } if (movingItem == null || sourceList == null || destinationList == null) { return; } if (destination == source) { return; } //Remove from source, add to destination. destinationList.MySubListItems.Add(movingItem); sourceList.MySubListItems.Remove(movingItem); e.Handled = true; }
private void ShowFilePath() { foreach (MyList list in new MyList[] { shellList, shellNewList, sendToList, openWithList, winXList, guidBlockedList, iEList }) { list.HoveredItemChanged += (sender, e) => { MyListItem item = list.HoveredItem; if (item is ITsiFilePathItem pathItem) { string path = pathItem.ItemFilePath; if (path != null) { if (File.Exists(path) || path.StartsWith("shell:AppsFolder")) { StatusBar.Text = path; return; } } } if (item is GuidBlockedItem guidItem) { StatusBar.Text = guidItem.Value; return; } else if (item is ShellList.SelectItem selectItem) { switch (shellList.Scene) { case ShellList.Scenes.CustomRegPath: StatusBar.Text = ShellList.CurrentCustomRegPath ?? item.Text; return; case ShellList.Scenes.MenuAnalysis: StatusBar.Text = ShellList.CurrentFileObjectPath ?? item.Text; return; } } string regPath = item.GetType().GetProperty("RegPath")?.GetValue(item, null)?.ToString(); if (regPath != null) { StatusBar.Text = regPath; } else { StatusBar.Text = item.Text; } }; } }
public DeleteButton(IBtnDeleteItem item) : base(AppImage.Delete) { MyListItem listItem = (MyListItem)item; listItem.AddCtr(this); this.MouseDown += (sender, e) => { if (MessageBoxEx.Show(AppString.Message.ConfirmDelete, MessageBoxButtons.YesNo) == DialogResult.Yes) { MyList list = (MyList)listItem.Parent; int index = list.GetItemIndex(listItem); index -= (index < list.Controls.Count - 1) ? 0 : 1; item.DeleteMe(); list.HoveredItem = (MyListItem)list.Controls[index]; } }; }
private void addNewAreaItem(string name = "") { if (lastFocus is MyListItem) { MyAreaPanel area = (MyAreaPanel)(((MyListItem)lastFocus).Parent); //MyAreaPanel area = userArea[0]; MyListItem item = new MyListItem(userAreaPanel, false); area.Height += 19; area.items.Add(item.ItemName); area.Controls.Add(item); item.Tb.Focus(); if (name != "") { item.ItemName = name; item.Tb.Text = name; MyInteraction.listClick(item); } } }
public void AddList(MyList myList) { myList.Owner = listBox; myList.HoveredItemChanged += (sender, e) => { if (!AppConfig.ShowFilePath) { return; } MyListItem item = myList.HoveredItem; foreach (string prop in new[] { "ItemFilePath", "RegPath", "GroupPath" }) { string path = item.GetType().GetProperty(prop)?.GetValue(item, null)?.ToString(); if (!path.IsNullOrWhiteSpace()) { statusBar.Text = path; return; } } statusBar.Text = item.Text; }; }
private void MoveItem(MyListItem item, bool isUp) { int index = this.GetItemIndex(item); if (isUp) { if (index > 1) { this.SetItemIndex(item, index - 1); this.SubKeyNames.Reverse(index - 2, 2); } } else { if (index < this.Controls.Count - 1) { this.SetItemIndex(item, index + 1); this.SubKeyNames.Reverse(index - 1, 2); } } this.SaveSorting(); }
private static void MoveItem(MyListItem item, CommonMultiItemsList list, bool isUp) { int index = list.GetItemIndex(item); if (isUp) { if (index > 1) { list.SetItemIndex(item, index - 1); list.SubKeyNames.Reverse(index - 2, 2); } } else { if (index < list.Controls.Count - 1) { list.SetItemIndex(item, index + 1); list.SubKeyNames.Reverse(index - 1, 2); } } list.WriteRegistry(); }
private void ShowFilePath() { foreach (MyList list in new MyList[] { shellList, shellNewList, sendToList, openWithList, winXList, guidBlockedList, iEList }) { list.HoveredItemChanged += (sender, e) => { MyListItem item = list.HoveredItem; if (item is ITsiFilePathItem pathItem) { string path = pathItem.ItemFilePath; if (File.Exists(path)) { StatusBar.Text = path; return; } } if (item is GuidBlockedItem guidItem) { StatusBar.Text = guidItem.Value; return; } StatusBar.Text = item.Text; }; } }
public IActionResult Dashboard() { User loggedInUser = JsonConvert.DeserializeObject <User>(HttpContext.Session.GetString("loggedInUser")); if (null == loggedInUser) { return(RedirectToAction("Login", "User")); } List <UserListUserMap> userListMap = dbContext.listUserMap .Include(p => p.listId) .Include(p => p.listId.listItems) .Include(p => p.userId) .Where(c => c.userId.userID == loggedInUser.userID).ToList <UserListUserMap>(); List <MyList> listsOwnded = new List <MyList>(); foreach (UserListUserMap map in userListMap) { UserList list = map.listId; MyList dashBoardList = new MyList(); listsOwnded.Add(dashBoardList); dashBoardList.listId = list.listId; dashBoardList.listName = list.listName; dashBoardList.description = list.listDescription; dashBoardList.listType = list.listType; foreach (UserListItem item in list.listItems) { MyListItem listItem = new MyListItem(); listItem.itemName = item.itemName; } } Dashboard userDashBoard = new Dashboard(); userDashBoard.listsOwned = listsOwnded; return(View(userDashBoard)); }
public VisibleCheckBox(IChkVisibleItem item) { MyListItem listItem = (MyListItem)item; listItem.AddCtr(this); this.MouseDown += (sender, e) => { if (e.Button == MouseButtons.Left) { item.ItemVisible = !this.Checked; this.Checked = item.ItemVisible; } }; listItem.ParentChanged += (sender, e) => { if (listItem.IsDisposed) { return; } if (listItem.Parent == null) { return; } if (listItem is IFoldSubItem subItem && subItem.FoldGroupItem != null) { return; } if (listItem.FindForm() is ShellStoreDialog.ShellStoreForm) { return; } if (AppConfig.HideDisabledItems) { listItem.Visible = item.ItemVisible; } }; }
public override int Add(object InValue) { MyListItem mli = new MyListItem(InValue); return base.Add(mli); } //Add()