コード例 #1
0
        private void OnContextCreateLinkClicked(object sender, RoutedEventArgs e)
        {
            var selectedItem = SelectedItem as CustomTreeItem;


            if (selectedItem != null)
            {
                LinkingDialog.ShowThisDialog(selectedItem);
            }
        }
コード例 #2
0
        public static void ShowThisDialog(CustomTreeItem selectedItem)
        {
            if (selectedItem == null)
            {
                throw new ArgumentNullException("selectedItem");
            }

            m_selectedItem = selectedItem;

            var instance = new LinkingDialog();

            instance.StartPosition = FormStartPosition.CenterParent;
            // Buttons for browsing
            instance.sourceBrowseButton.Text      = Properties.Resources.ButtonBrowse;
            instance.destinationBrowseButton.Text = Properties.Resources.ButtonBrowse;

            // OK Cancel buttons
            instance.okButton.Text     = Properties.Resources.ButtonOK;
            instance.cancelButton.Text = Properties.Resources.ButtonCancel;

            // Browsing destination is the same for both
            instance.destinationBrowseButton.Click += instance.BrowseDestinationFolder;

            // Creating the link / junction works the same for both
            instance.okButton.Click += instance.CreateHardLink;

            if (selectedItem.IsDirectory)
            {
                instance.InitJunctionDialog();
            }
            else
            {
                instance.InitHardLinkDialog();
            }

            instance.ShowDialog();
        }