Beispiel #1
0
	void ListView_BeforeLabelEdit (object sender, LabelEditEventArgs e)
	{
		string label = e.Label == null ? "(null)" : e.Label;
		_eventsText.AppendText (
			"BeforeLabelEdit => " + label + " | " + e.Item.ToString ()
			+ " | " + e.CancelEdit + Environment.NewLine);
	}
 void explorerListView1_BeforeLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (explorerListView1.SelectedItems.Count == 1)
     {
         ShellItem item = (ShellItem)explorerListView1.SelectedItems[0].Tag;
         if (!item.CanRename)
         {
             e.CancelEdit = true;
         }
     }
     else
     {
         e.CancelEdit = true;
     }
 }
Beispiel #3
0
        private void DosyaPanel_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            // Bu olay fonksiyonu dosya panelinde (bir ListView kontrolü)
            // bir dosyayı temsil eden eleman üzerinde etiket metni değiştikten
            // sonra işleme konacak ve isim değişikliğini elemanın temsil
            // ettiği asıl dosyaya yansıtacaktır. Ama eksik veya hatalıdır.
            ListViewItem seciliEleman = DosyaPanel.SelectedItems[0];
            FileInfo     dosya        = seciliEleman.Tag as FileInfo;

            if (dosya != null)
            {
                File.Replace(seciliEleman.Text, dosya.FullName,
                             dosya.Name + "_yedek");
            }
        }
Beispiel #4
0
 private void listViewContent_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (string.IsNullOrEmpty(e.Label) || string.IsNullOrEmpty(e.Label.Trim()))
     {
         e.CancelEdit = true;
     }
     else
     {
         var item = listViewContent.Items[e.Item];
         var node = item.Tag as TreeNode;
         node.Text = e.Label;
         (node.Tag as INesMenuElement).Name = e.Label;
         FixSort(item);
     }
 }
Beispiel #5
0
        private void ListView_AfterEdit(object sender, LabelEditEventArgs e)
        {
            string name    = currentListView.SelectedItems[0].Text;
            string newname = name;

            if (e.Label != null)
            {
                newname = e.Label.ToString();
            }

            if (currentFileMan.Rename(name, newname))
            {
                RefreshAll();
            }
        }
        private void variableListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            string name = e.Label;

            if (!string.IsNullOrEmpty(name))
            {
                var variable = (KeyValuePair <string, object>)variableListView.Items[e.Item].Tag;
                if (!Content.ContainsKey(name))
                {
                    Content.Remove(variable.Key);
                    Content.Add(name, variable.Value);
                }
            }
            e.CancelEdit = true;
        }
Beispiel #7
0
        private void lvwMain_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Label))
            {
                e.CancelEdit = true;
                return;
            }

            using (var transaction = _docData.Store.TransactionManager.BeginTransaction(Guid.NewGuid().ToString()))
            {
                var element = lvwMain.Items[e.Item].Tag as Microsoft.VisualStudio.Modeling.ModelElement;
                nHydrate.DslPackage.Objects.Utils.SetPropertyValue <string>(element, "Name", e.Label);
                transaction.Commit();
            }
        }
Beispiel #8
0
        private void variablesListView_BeforeLabelEdit(object sender, LabelEditEventArgs e)
        {
            TreeTableNode node = variablesListView.Nodes[e.Item];

            if (node.Parent != variablesListView.Root)
            {
                e.CancelEdit = true;
            }
            else
            {
                contextMenuStrip.Enabled = false;
                toolStrip1.Enabled       = false;
                m_editInProgress         = true;
            }
        }
Beispiel #9
0
        private void lvLanguageEditor_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (!(sender is ListView) || !(((ListView)sender).Items[e.Item] is TranslationEntity))
            {
                return;
            }

            TranslationEntity translationEntity = lvLanguageEditor.Items[e.Item] as TranslationEntity;

            if (e.Label != null && string.Compare(e.Label.Trim(), translationEntity.Translation, StringComparison.InvariantCulture) != 0)
            {
                translationEntity.Edited          = true;
                translationEntity.Language.Edited = true;
            }
        }
Beispiel #10
0
        private void bankListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.CancelEdit)
            {
                return;
            }
            var item   = (sender as ListView).Items[e.Item];
            var scheme = item.Tag as Scheme;

            if (scheme != null && e.Label != "")
            {
                scheme.Name = e.Label;
            }
            //updateBankListView();
        }
Beispiel #11
0
        private void mainView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            try {
                string setText;
                setText = e.Label;
                if (setText == "")
                {
                    wm.StartInfobox95("Windows Explorer", "Please enter a new directory name", InfoboxType.Info, InfoboxButtons.OK);
                }
                else
                {
                    if (Directory.Exists(setText))
                    {
                        wm.StartInfobox95("Windows Explorer", "That directory already exists.", InfoboxType.Info, InfoboxButtons.OK);
                    }
                    else
                    {
                        if (File.Exists(setText))
                        {
                            wm.StartInfobox95("Windows Explorer", "That file already exists.", InfoboxType.Info, InfoboxButtons.OK);
                        }
                        else
                        {
                            if (Directory.Exists(mainView.FocusedItem.ImageKey))
                            {
                                // It was a directory

                                Directory.Move(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText));

                                File.Delete(Path.Combine(CurrentDirectory, setText, "_data.info"));

                                SaveDirectoryInfo(CurrentDirectory, setText, false, $"{setText}", true);
                            }
                            else
                            {
                                // It was a file

                                File.Copy(mainView.FocusedItem.ImageKey, Path.Combine(CurrentDirectory, setText));
                                File.Delete(mainView.FocusedItem.ImageKey);
                            }
                        }
                    }
                }
                RefreshAll();
                RefreshTreeNode();
            } catch {
            }
        }
        void explorerListView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            ShellItem item = (ShellItem)explorerListView1.SelectedItems[0].Tag;
            String    from = item.Path;

            if (Regex.IsMatch(from, @"^[a-z]:\\\w+", RegexOptions.IgnoreCase))
            {
                String to = item.Parent.Path + "\\" + e.Label;
                ShellAPI.SHFILEOPSTRUCT fileOp = new ShellAPI.SHFILEOPSTRUCT();
                fileOp.hwnd  = ParentForm.Handle;
                fileOp.wFunc = ShellAPI.FO_Func.RENAME;
                fileOp.pFrom = Marshal.StringToHGlobalUni(from + '\0');
                fileOp.pTo   = Marshal.StringToHGlobalUni(to + '\0');
                ShellAPI.SHFileOperation(ref fileOp);
            }
        }
Beispiel #13
0
        private void lvCategories_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            var item     = (ListViewItem)lvCategories.Items[e.Item];
            var category = (Category)item.Tag;

            try {
                Validation.ValidateCategory(new Category(e.Label));
            }
            catch (Exception) {
                e.CancelEdit = true;
                return;
            }

            category.Name = e.Label;
            UpdateCategories();
        }
        /// <summary>
        /// Handles the AfterLabelEdit event of the listView control.
        /// Sets new name to the edited prototype.
        /// </summary>
        private void listView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            Actor actor = listView.Items[e.Item].Tag as Actor;

            if (e.Label != null && actor.Name != e.Label)
            {
                if (e.Label == String.Empty)
                {
                    e.CancelEdit = true;
                }
                else
                {
                    actor.Name = e.Label;
                }
            }
        }
Beispiel #15
0
 private void list_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if ((e != null) && (e.Label != null) && (e.Label.Length > 0))
     {
         var iAddress = ((MagiWolDocument.Address)list.Items[e.Item]);
         iAddress.Title    = e.Label;
         this.list.Enabled = false;
         this.Document.MarkAsChanged();
         tmrReSort.Tag     = iAddress;
         tmrReSort.Enabled = true;
     }
     else
     {
         e.CancelEdit = true;
     }
 }
Beispiel #16
0
        void listView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            listView.LabelEdit = false;

            if (_pixmapManage.isItemExist(e.Label))
            {
                e.CancelEdit = true;
                return;
            }

            //执行具体的重命名
            ListViewItem tmpItem = listView.Items[e.Item];

            _pixmapManage.renameItem(treeView.SelectedNode.Text, tmpItem.Text, e.Label);
            saveIconInfo();
        }
        private void OnBeforeLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (_nodeInEditMode || !(sender is ConnectionTree))
            {
                return;
            }

            if (!_allowEdit || SelectedNode is PuttySessionInfo || SelectedNode is RootPuttySessionsNodeInfo)
            {
                e.CancelEdit = true;
                return;
            }

            _nodeInEditMode = true;
            _contextMenu.DisableShortcutKeys();
        }
Beispiel #18
0
        private void CheckIfUserEditName(object sender, LabelEditEventArgs e)
        {
            var ip = LstConnection.Items[e.Item].SubItems[2].Text;

            try
            {
                var target     = server[ip];
                var clientName = e.Label;
                regSettingVps.In(target.AliasName).SetInfo("clientName", clientName);
                target.Send(new CmdSetClientNameMessage(clientName));
            }
            catch (Exception ex)
            {
                AppendLog(ip, $"修改终端名称失败:{ex.Message}");
            }
        }
Beispiel #19
0
        private void lvColumns_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label == null)
            {
                return;
            }
            if (e.Label == "")
            {
                e.CancelEdit = true;
                return;
            }
            GridControlColumn c = lvColumns.Items[e.Item].Tag as GridControlColumn;

            c.HeaderText = e.Label;
            UpdateControls();
        }
Beispiel #20
0
 /// <summary>
 /// Überprüft bei Eingabe von Zeichen in eine der Listen ob der Wert numerisch ist und setzt ihn zurück, wenn die Überprüfung fehlschlägt.
 /// </summary>
 private void CheckNumericValue(object sender, LabelEditEventArgs e)
 {
     if (e.Label == null)
     {
         return;
     }
     else
     {
         if (!int.TryParse(e.Label, out _)) //Wenn nicht geparsed werden kann -> zurück auf den gespeicherten Wert
         {
             e.CancelEdit = true;
             SendToConsole(String.Format("Falsches Zeichenformat in {0} Zeile {1} eingegeben: {2}\n", productlist.SelectedItem.ToString(), e.Item, e.Label));
             consoleOutput.BackColor = Color.Orange;
         }
     }
 }
Beispiel #21
0
 private void listViewRemote_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     try
     {
         string       NewLabel = e.Label;
         ListViewItem lvi      = listViewRemote.Items[e.Item];
         nfsClient.Move(
             nfsClient.Combine(lvi.Text, RemoteFolder),
             nfsClient.Combine(NewLabel, RemoteFolder)
             );
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "NFS Client");
     }
 }
 private void DataListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Label))
     {
         object obj = this.ParseString(e.Label);
         if (obj != null)
         {
             base.InternalEditValue(e.Item, obj, true);
         }
     }
     else if (e.Label != null)
     {
         base.ShowErrorAsync(Strings.InlineEditCannotBlankEntry);
     }
     e.CancelEdit = true;
 }
        /// <summary>
        /// Handles the AfterLabelEdit event of the listView control.
        /// Sets new name to the edited drawable asset.
        /// </summary>
        private void listView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            DrawableAssetType drawableAsset = listView.Items[e.Item].Tag as DrawableAssetType;

            if (e.Label != null && drawableAsset.Name != e.Label)
            {
                if (e.Label == String.Empty)
                {
                    e.CancelEdit = true;
                }
                else
                {
                    drawableAsset.Name = e.Label;
                }
            }
        }
Beispiel #24
0
 /// <summary>
 ///   Rename the file, if the name has changed
 /// </summary>
 /// <param name = "sender"></param>
 /// <param name = "e"></param>
 private void listViewNonMusicFiles_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     _inLabeledit = false;
     if (_savedLabelValue != e.Label)
     {
         try
         {
             FileSystem.MoveFile(_savedLabelValue, e.Label, UIOption.AllDialogs, UICancelOption.DoNothing);
         }
         catch (Exception ex)
         {
             listViewNonMusicFiles.Items[e.Item].Text = _savedLabelValue;
             log.Error("Error renaming file: {0} to {1} Exception: {2}", _savedLabelValue, e.Label, ex.Message);
         }
     }
 }
Beispiel #25
0
        private void LvFiles_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            var item  = lvFiles.Items[e.Item].Tag as FileItem;
            int order = 0;

            if (int.TryParse(e.Label, out order))
            {
                item.Order = order;
                lvFiles.BeginInvoke((update)UpdateListView);
            }
            else
            {
                MessageBox.Show("Please input an integer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                e.CancelEdit = true;
            }
        }
        private void OnAfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                try
                {
                    ((IGalleryItem)_gallery[e.Item]).Name = e.Label;
                    return;
                }
                catch (Exception) {
                    // if editing the name on the item fails, abort the label change
                }
            }

            e.CancelEdit = true;
        }
Beispiel #27
0
        private void OnAfterListViewLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Label))
            {
                e.CancelEdit = true;
                return;
            }

            var label = e.Label.Trim();

            if (string.IsNullOrEmpty(label))
            {
                e.CancelEdit = true;
                return;
            }

            if (!Rhino.DocObjects.Layer.IsValidName(label))
            {
                e.CancelEdit = true;
                return;
            }

            var doc = RhinoDoc.ActiveDoc;

            if (null == doc)
            {
                e.CancelEdit = true;
                return;
            }

            var index = e.Item;
            var item  = m_list.Items[index];

            if (null != item)
            {
                var sn = (uint)item.Tag;
                foreach (var view in doc.Views.GetPageViews())
                {
                    if (view.RuntimeSerialNumber == sn)
                    {
                        view.PageName = label;
                        doc.Views.Redraw();
                        break;
                    }
                }
            }
        }
Beispiel #28
0
        private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            // If the label is null return.
            if (e.Label == null)
            {
                return;
            }

            // Get the new full file name using the file extension from the list view item.
            ListViewItemTag itemTag      = (ListViewItemTag)this.listView1.Items[e.Item].Tag;
            string          fullFileName = e.Label + "." + itemTag.FileExtension;

            // Make sure the length of the item text is valid.
            if (e.Label.Length == 0 || e.Label.Length > ArchiveFileEntry.kUsableFileNameLength)
            {
                // Set the item color to red.
                this.listView1.Items[e.Item].BackColor   = Color.PaleVioletRed;
                this.listView1.Items[e.Item].ToolTipText = "File name is too long or too short!";

                // Display an error to the user.
                MessageBox.Show("File name is either too short or too long, must be between 1 and 63 characters!", "Invalid file names", MessageBoxButtons.OK);
            }
            else if ((this.existingFileNames != null && this.existingFileNames.Contains(fullFileName) == true) || FindListViewItem(e.Label, itemTag.FileExtension) == true)
            {
                // Set the item color to red.
                this.listView1.Items[e.Item].BackColor   = Color.PaleVioletRed;
                this.listView1.Items[e.Item].ToolTipText = "File name is already in use!";

                // Display an error to the user.
                MessageBox.Show("File name is already in use!", "Invalid file names", MessageBoxButtons.OK);
            }
            else
            {
                // Restore the item color in case it was red.
                this.listView1.Items[e.Item].BackColor   = Color.FromKnownColor(KnownColor.Window);
                this.listView1.Items[e.Item].ToolTipText = "";

                // In case there was a duplicate item, find it, and change the color and tooltip.
                ListViewItem dupItem = FindDuplicateItem(this.listView1.Items[e.Item]);
                if (dupItem != null)
                {
                    // Restore item color and tooltip text.
                    dupItem.BackColor   = Color.FromKnownColor(KnownColor.Window);
                    dupItem.ToolTipText = "";
                }
            }
        }
Beispiel #29
0
        /// <summary>
        /// ListView after edit label event hander
        /// </summary>
        private void OnListViewAfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            // Always cancel. Item will be refreshed when the page view is renamed
            e.CancelEdit = true;

            if (string.IsNullOrEmpty(e.Label))
            {
                return;
            }

            var label = e.Label.Trim();

            if (string.IsNullOrEmpty(label))
            {
                return;
            }

            // User layer's name validator
            if (!Rhino.DocObjects.Layer.IsValidName(label))
            {
                return;
            }

            var doc = RhinoDoc.ActiveDoc;

            if (null == doc)
            {
                return;
            }

            var index = e.Item;
            var item  = m_list.Items[index];

            if (null != item)
            {
                var sn = (uint)item.Tag;
                foreach (var view in doc.Views.GetPageViews())
                {
                    if (view.RuntimeSerialNumber == sn)
                    {
                        view.PageName = label;
                        doc.Views.Redraw();
                        break;
                    }
                }
            }
        }
        protected override void OnBeforeLabelEdit(LabelEditEventArgs e)
        {
            if ((e.Item != -1) && (EditTaskLabel != null))
            {
                var item = (Items[e.Item].Tag as CloudTaskItem);

                if (item != null)
                {
                    EditTaskLabel(this, item.Id);

                    e.CancelEdit = true;
                    return;
                }
            }

            base.OnBeforeLabelEdit(e);
        }
Beispiel #31
0
 private void lstSavedItems_AfterLabelEdit(
     object sender, LabelEditEventArgs e)
 {
     if (e.Label != null)
     {
         if (!MyQueryManager.MyEventViewer.MonitoringItems.ContainsKey(e.Label) &
             !lstSavedItems.Items.ContainsKey(e.Label))
         {
             lstSavedItems.Items[e.Item].BackColor = Color.White;
         }
         else
         {
             lstSavedItems.Items[e.Item].BackColor = Color.Orange;
         }
         lstSavedItems.Items[e.Item].Name = e.Label;
     }
 }
 private void listView1_BeforeLabelEdit(object sender, LabelEditEventArgs e)
 {
     canDeleteFlag = false;
 }
Beispiel #33
0
 void lv_moversAfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     NamenErneuern();
 }
 private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     canDeleteFlag = false;
     new DxInfo(selectedPath).rename(e.Label);
     canDeleteFlag = true;
 }