Пример #1
0
        public void Navigate(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.Parameter == null || !(e.Parameter is string))
            {
                return;
            }
            string param = e.Parameter as string;

            if (param[0] == '.')
            {
                param = param.Substring(1);
            }
            if (param[0] == '.')
            {
                param = param.Substring(1);
            }
            string path = ClrMDRIndex.Setup.HelpFolder + param;

            if (File.Exists(path))
            {
                Dispatcher.CurrentDispatcher.InvokeAsync(() => ValueWindows.ShowHelpWindow(path));
                //ValueWindows.ShowHelpWindow(path);
                //string title;
                //string md = LoadHelpFile(path, out title);
                //DocumentViewer.Document = _markdown.Transform(md);
                //this.Title = title;
            }
        }
Пример #2
0
        private void ItemListDoubleClicked(object sender, MouseButtonEventArgs e)
        {
            if (CollectionValues.SelectedIndex < 0)
            {
                return;
            }
            DisplayableString item = (DisplayableString)CollectionValues.SelectedItem;

            if (_instanceValue.Fields != null && _instanceValue.Fields.Length == 1 && _instanceValue.Fields[0].Kind == ClrElementKind.String)
            {
                if (!item.IsLong())
                {
                    return;
                }
                var fld  = _instanceValue.Fields[0];
                var inst = new InstanceValue(fld.TypeId, fld.Address, fld.TypeName, string.Empty, item.FullContent);
                Dispatcher.CurrentDispatcher.InvokeAsync(() => ValueWindows.ShowContentWindow(fld.GetDescription(), inst, ValueWindows.WndType.Content));
                return;
            }
            ulong addr = GetAddressFromEntry(item.FullContent);

            if (addr != Constants.InvalidAddress)
            {
                Dispatcher.CurrentDispatcher.InvokeAsync(() => ((MainWindow)Owner).ExecuteInstanceValueQuery("Getting object value at: " + Utils.RealAddressString(addr), addr));
            }
        }
Пример #3
0
 private void LockBtnClicked(object sender, RoutedEventArgs e)
 {
     if (_locked)
     {
         _locked         = false;
         LockBtn.Content = _unlockedImg;
         ValueWindows.ChangeMyLock(_id, _wndType, false);
     }
     else
     {
         _locked         = true;
         LockBtn.Content = _lockedImg;
         ValueWindows.ChangeMyLock(_id, _wndType, true);
     }
 }
Пример #4
0
        private void GetInstValueClicked(bool forKey)
        {
            string value = GetSelectionString(forKey); // true for key

            if (value == null)
            {
                return;
            }
            ulong addr = GetAddressFromEntry(value);

            if (addr != Constants.InvalidAddress)
            {
                System.Windows.Threading.Dispatcher.CurrentDispatcher.InvokeAsync(() => ((MainWindow)Owner).ExecuteInstanceValueQuery("Getting object value at: " + Utils.RealAddressString(addr), addr));
            }
            if (DisplayableString.IsLargeString(value))
            {
                var inst = new InstanceValue(Constants.InvalidIndex, ClrElementKind.Unknown, Constants.InvalidAddress, "FROM: " + _instValue.TypeName, null, value);
                ValueWindows.ShowContentWindow("A collection item " + (forKey ? "key." : "value."), inst, ValueWindows.WndType.Content);
                return;
            }
            ((MainWindow)Owner).MainStatusShowMessage("The value requested cannot be elaborated more. The values is what you see.");
        }
Пример #5
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     var wndtask = Task.Factory.StartNew(() => ValueWindows.RemoveWindow(_id, _wndType));
 }
Пример #6
0
 private void ButtonHelpClicked(object sender, RoutedEventArgs e)
 {
     ValueWindows.ShowHelpWindow(Setup.HelpFolder + System.IO.Path.DirectorySeparatorChar + @"\Documentation\ValueWindows.md");
 }
Пример #7
0
 public void Window_Closing(object sender, CancelEventArgs e)
 {
     var wndtask = Task.Factory.StartNew(() => ValueWindows.RemoveWindow(_id, _wndType));
 }
Пример #8
0
        private async void GetInstanceValue(TreeViewItem selTreeItem, InstanceValue selInstValue, bool rawValue = false)
        {
            if (TypeExtractor.IsString(selInstValue.Kind))
            {
                if (selInstValue.Value.IsLong())
                {
                    ValueWindows.ShowContentWindow(selInstValue.GetDescription(), selInstValue, ValueWindows.WndType.Content);
                }
                return;
            }

            if (selInstValue.HaveFields())
            {
                return;                            // already has values
            }
            ulong addr = _mainWindow.GetAddressFromEntry(selInstValue.Value.FullContent);

            if (selInstValue.Address != Constants.InvalidAddress && addr != Constants.InvalidAddress && addr == selInstValue.Address)
            {
                if (!rawValue) // if known collection show it in a collection window
                {
                    if (TypeExtractor.IsKnownType(selInstValue.TypeName))
                    {
                        var msg = "Getting object value at: " + Utils.RealAddressString(selInstValue.Address);
                        _mainWindow.ExecuteInstanceValueQuery(msg, selInstValue.Address);
                        return;
                    }
                }
                var index = MainWindow.CurrentIndex;

                StatusText.Text      = "Getting value at address: " + selInstValue.Address + ", please wait...";
                Mouse.OverrideCursor = Cursors.Wait;

                (string error, InstanceValue[] fields) = await Task.Factory.StartNew(() =>
                {
                    return(index.GetInstanceValueFields(selInstValue.Address, selInstValue.Parent));
                }, _mainWindow.DumpSTAScheduler);

                if (Utils.IsInformation(error))
                {
                    StatusText.Text = error;
                }
                else
                {
                    StatusText.Text = "Getting fields at address: " + selInstValue.Address + (fields != null ? ", done." : ", failed.");
                }
                Mouse.OverrideCursor = null;

                if (error != null && !Utils.IsInformation(error))
                {
                    GuiUtils.ShowError(error, this);
                    return;
                }

                if (fields.Length < 1)
                {
                    return;
                }

                if (fields.Length == 1 && fields[0].IsArray())
                {
                    ValueWindows.ShowContentWindow(fields[0].GetDescription(), fields[0], ValueWindows.WndType.List);
                    return;
                }

                if (fields.Length > 0)
                {
                    selInstValue.SetFields(fields);
                    for (int i = 0, icount = fields.Length; i < icount; ++i)
                    {
                        var fld    = fields[i];
                        var tvNode = new TreeViewItem
                        {
                            Header = GuiUtils.GetInstanceValueStackPanel(fld),
                            Tag    = fld
                        };
                        selTreeItem.Items.Add(tvNode);
                    }
                }
                selTreeItem.ExpandSubtree();
            }
            else
            {
                StatusText.Text = "Value for " + selInstValue.TypeName + " cannot be expanded.";
                return;
            }
        }