示例#1
0
		public MainWindow()
		{
			instance = this;
			spySettings = ILSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.assemblyListManager = new AssemblyListManager(spySettings);
			
			this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
			
			this.DataContext = sessionSettings;
			
			InitializeComponent();
			App.CompositionContainer.ComposeParts(this);
			mainPane.Content = decompilerTextView;
			
			if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
				leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
				rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
			}
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
			
			InitMainMenu();
			InitToolbar();
			ContextMenuProvider.Add(treeView, decompilerTextView);
			
			this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
		}
示例#2
0
		private void WireAssemblyEvents(MainWindow instance)
		{
			instance.CurrentAssemblyListChanged += (sender, args) =>
			{
				if (args.NewItems != null && args.NewItems.Count > 0)
					AssemblyLoaded(this, EventArgs.Empty);
				else
				{
					// Ignore if we are hot replacing an assembly
					if (UpdatingHostObjectModel)
						return;

					AssemblyUnloaded(this, EventArgs.Empty);
					
					// Remove loaded contexts
					var plugin = PluginFactory.GetInstance() as ILSpyPlugin;
					if (plugin == null)
						return;

					if (args.OldItems == null)
						return;

					foreach (LoadedAssembly loadedAssembly in args.OldItems)
						plugin.RemoveAssemblyContext(loadedAssembly.FileName);
				}
			};
		}
示例#3
0
		public MainWindow()
		{
			instance = this;
			spySettings = ILSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.assemblyListManager = new AssemblyListManager(spySettings);
			
			if (Environment.OSVersion.Version.Major >= 6)
				this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
			else
				this.Icon = Images.AssemblyLoading;
			
			this.DataContext = sessionSettings;
			this.Left = sessionSettings.WindowBounds.Left;
			this.Top = sessionSettings.WindowBounds.Top;
			this.Width = sessionSettings.WindowBounds.Width;
			this.Height = sessionSettings.WindowBounds.Height;
			// TODO: validate bounds (maybe a monitor was removed...)
			this.WindowState = sessionSettings.WindowState;
			
			InitializeComponent();
			decompilerTextView.mainWindow = this;
			
			if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
				leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
				rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
			}
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
			
			this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
		}
示例#4
0
		public MainWindow()
		{
			instance = this;
			spySettings = ILSpySettings.Load();
			this.sessionSettings = new SessionSettings(spySettings);
			this.assemblyListManager = new AssemblyListManager(spySettings);
			
			this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico"));
			
			this.DataContext = sessionSettings;
			this.Left = sessionSettings.WindowBounds.Left;
			this.Top = sessionSettings.WindowBounds.Top;
			this.Width = sessionSettings.WindowBounds.Width;
			this.Height = sessionSettings.WindowBounds.Height;
			// TODO: validate bounds (maybe a monitor was removed...)
			this.WindowState = sessionSettings.WindowState;
			
			InitializeComponent();
			App.CompositionContainer.ComposeParts(this);
			Grid.SetRow(decompilerTextView, 1);
			rightPane.Children.Add(decompilerTextView);
			
			if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) {
				leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star);
				rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star);
			}
			sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;
			
			InitMainMenu();
			InitToolbar();
			ContextMenuProvider.Add(treeView);
			ContextMenuProvider.Add(analyzerTree);
			
			this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
		}
示例#5
0
 void MainWindow_CanExecuteEvent(object sender, MainWindow.CanExecuteEventArgs e)
 {
     if (e.Type == MainWindow.CanExecuteType.ReloadList) {
         if (Instance.IsDebugging)
             e.Result = false;
     }
 }
示例#6
0
		void MainWindow_OnModuleModified(object sender, MainWindow.ModuleModifiedEventArgs e) {
			((AnalyzerRootNode)Root).HandleModelUpdated(e.DnSpyFile);
		}
示例#7
0
		void MainWindow_OnModuleModified(object sender, MainWindow.ModuleModifiedEventArgs e)
		{
			((AnalyzerRootNode)Root).HandleModelUpdated(e.LoadedAssembly);
		}
示例#8
0
        public MainWindow()
        {
            instance = this;
            mainMenu = new Menu();
            spySettings = ILSpySettings.Load();
            this.sessionSettings = new SessionSettings(spySettings);
            this.sessionSettings.PropertyChanged += sessionSettings_PropertyChanged;
            this.assemblyListManager = new AssemblyListManager(spySettings);
            Themes.ThemeChanged += Themes_ThemeChanged;
            Themes.IsHighContrastChanged += (s, e) => Themes.SwitchThemeIfNecessary();
            Options.DisplaySettingsPanel.CurrentDisplaySettings.PropertyChanged += CurrentDisplaySettings_PropertyChanged;
            OtherSettings.Instance.PropertyChanged += OtherSettings_PropertyChanged;
            InitializeTextEditorFontResource();

            languageComboBox = new ComboBox() {
                DisplayMemberPath = "Name",
                Width = 100,
                ItemsSource = Languages.AllLanguages,
            };
            languageComboBox.SetBinding(ComboBox.SelectedItemProperty, new Binding("FilterSettings.Language") {
                Source = sessionSettings,
            });

            InitializeComponent();
            AddTitleInfo(IntPtr.Size == 4 ? "x86" : "x64");
            App.CompositionContainer.ComposeParts(this);

            if (sessionSettings.LeftColumnWidth > 0)
                leftColumn.Width = new GridLength(sessionSettings.LeftColumnWidth, GridUnitType.Pixel);
            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InstallCommands();

            tabGroupsManager = new TabGroupsManager<TabState>(tabGroupsContentPresenter, tabManager_OnSelectionChanged, tabManager_OnAddRemoveTabState);
            tabGroupsManager.OnTabGroupSelected += tabGroupsManager_OnTabGroupSelected;
            var theme = Themes.GetThemeOrDefault(sessionSettings.ThemeName);
            if (theme.IsHighContrast != Themes.IsHighContrast)
                theme = Themes.GetThemeOrDefault(Themes.CurrentDefaultThemeName) ?? theme;
            Themes.Theme = theme;
            InitializeAssemblyTreeView(treeView);

            InitMainMenu();
            InitToolbar();
            loadingImage.Source = ImageCache.Instance.GetImage("dnSpy-Big", theme.GetColor(ColorType.EnvironmentBackground).InheritedColor.Background.GetColor(null).Value);

            this.Activated += (s, e) => UpdateSystemMenuImage();
            this.Deactivated += (s, e) => UpdateSystemMenuImage();
            this.ContentRendered += MainWindow_ContentRendered;
            this.IsEnabled = false;
        }
示例#9
0
 void OnTabStateAdded(object sender, MainWindow.TabStateEventArgs e)
 {
     OnTabStateAdded(e.TabState);
 }
示例#10
0
		private void WireTreeviewEvents(MainWindow instance)
		{
			instance.SelectionChanged += ActiveItemChanged;
		}