Exemple #1
0
        private void RepoList_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (sender == this.RepoList && e.ChangedButton == MouseButton.Right)
            {
                // store selected item for later (when context menu selection is done)
                var fi = this.RepoList.SelectedItem as PackageContainerRepoItem;
                this.rightClickSelectedItem = fi;

                // find context menu
                ContextMenu cm = this.FindResource("ContextMenuFileItem") as ContextMenu;
                if (cm == null)
                {
                    return;
                }

                // set some fields in context menu
                var x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxTag");
                if (x != null && fi != null)
                {
                    x.Text = "" + fi.Tag;
                }

                x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxDescription");
                if (x != null && fi != null)
                {
                    x.Text = "" + fi.Description;
                }

                x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxCode");
                if (x != null && fi != null)
                {
                    x.Text = "" + fi.CodeType2D;
                }

                var cb = AasxWpfBaseUtils.FindChildLogicalTree <CheckBox>(cm, "CheckBoxLoadResident");
                if (cb != null && fi?.ContainerOptions != null)
                {
                    cb.IsChecked = fi.ContainerOptions.LoadResident;
                }

                cb = AasxWpfBaseUtils.FindChildLogicalTree <CheckBox>(cm, "CheckBoxStayConnected");
                if (cb != null && fi?.ContainerOptions != null)
                {
                    cb.IsChecked = fi.ContainerOptions.StayConnected;
                }

                x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxUpdatePeriod");
                if (x != null && fi?.ContainerOptions != null)
                {
                    x.Text = "" + fi.ContainerOptions.UpdatePeriod;
                }

                // show context menu
                cm.PlacementTarget = sender as Button;
                cm.IsOpen          = true;
            }
        }
Exemple #2
0
        private void RepoList_PreviewMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (sender == this.RepoList && e.ChangedButton == MouseButton.Right)
            {
                // store selected item for later (when context menu selection is done)
                var fi = this.RepoList.SelectedItem as AasxFileRepository.FileItem;
                this.rightClickSelectedItem = fi;

                // find context menu
                ContextMenu cm = this.FindResource("ContextMenuFileItem") as ContextMenu;
                if (cm == null)
                {
                    return;
                }

                // set some fields in context menu
                var x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxTag");
                if (x != null && fi != null)
                {
                    x.Text = "" + fi.Tag;
                }

                x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxDescription");
                if (x != null && fi != null)
                {
                    x.Text = "" + fi.Description;
                }

                x = AasxWpfBaseUtils.FindChildLogicalTree <TextBox>(cm, "TextBoxCode");
                if (x != null && fi != null)
                {
                    x.Text = "" + fi.CodeType2D;
                }

                // show context menu
                cm.PlacementTarget = sender as Button;
                cm.IsOpen          = true;
            }
        }