Esempio n. 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);
		}
Esempio n. 2
0
        public MainWindow()
        {
            spySettings = ILSpySettings.Load();
            this.sessionSettings = new SessionSettings(spySettings);
            this.assemblyListManager = new AssemblyListManager(spySettings);

            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;

            #if DEBUG
            AddDebugItemsToToolbar();
            #endif
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }
Esempio n. 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);
		}
Esempio n. 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);
		}
Esempio n. 5
0
        void Assemblies_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            bool callGc = ClearCache();

            // Whenever the assembly list is modified, mark it as dirty
            // and enqueue a task that saves it once the UI has finished modifying the assembly list.
            if (!dirty)
            {
                dirty = true;
                if (App.Current == null)
                {
                    dirty = false;
                    AssemblyListManager.SaveList(this);
                    callGc |= ClearCache();
                    if (callGc)
                    {
                        CallGc();
                    }
                }
                else
                {
                    App.Current.Dispatcher.BeginInvoke(
                        DispatcherPriority.Background,
                        new Action(
                            delegate {
                        dirty = false;

                        AssemblyListManager.SaveList(this);
                        ClearCache();
                        callGc |= ClearCache();
                        if (callGc)
                        {
                            CallGc();
                        }
                    })
                        );
                }
            }
            else if (callGc)
            {
                CallGc();
            }
        }
Esempio n. 6
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();
            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);
        }
Esempio n. 7
0
 void Assemblies_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     assemblyLookupCache.Clear();
     // Whenever the assembly list is modified, mark it as dirty
     // and enqueue a task that saves it once the UI has finished modifying the assembly list.
     if (!dirty)
     {
         dirty = true;
         App.Current.Dispatcher.BeginInvoke(
             DispatcherPriority.Background,
             new Action(
                 delegate {
             dirty = false;
             AssemblyListManager.SaveList(this);
             assemblyLookupCache.Clear();
         })
             );
     }
 }
Esempio n. 8
0
 internal void RefreshSave()
 {
     // Whenever the assembly list is modified, mark it as dirty
     // and enqueue a task that saves it once the UI has finished modifying the assembly list.
     if (!dirty)
     {
         dirty = true;
         App.Current.Dispatcher.BeginInvoke(
             DispatcherPriority.Background,
             new Action(
                 delegate {
             if (dirty)
             {
                 dirty = false;
                 AssemblyListManager.SaveList(this);
             }
         })
             );
     }
 }
Esempio n. 9
0
        public MainWindow()
        {
            instance = this;
            var spySettings = ILSpySettings.Load();

            this.spySettingsForMainWindow_Loaded = spySettings;
            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 = new MainWindowDataContext {
                Workspace       = DockWorkspace.Instance,
                SessionSettings = sessionSettings
            };

            DockWorkspace.Instance.LoadSettings(sessionSettings);

            InitializeComponent();

            XmlLayoutSerializer serializer = new XmlLayoutSerializer(DockManager);

            serializer.LayoutSerializationCallback += DockWorkspace.Instance.LayoutSerializationCallback;
            try {
                sessionSettings.DockLayout.Deserialize(serializer);
            } finally {
                serializer.LayoutSerializationCallback -= DockWorkspace.Instance.LayoutSerializationCallback;
            }

            DockWorkspace.Instance.EnsureUnclosablePanes();

            sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged;

            InitMainMenu();
            InitToolbar();
            ContextMenuProvider.Add(treeView);

            this.Loaded += MainWindow_Loaded;
        }
Esempio n. 10
0
 public OpenListDialog()
 {
     InitializeComponent();
     manager = MainWindow.Instance.assemblyListManager;
 }
Esempio n. 11
0
 public OpenListDialog()
 {
     InitializeComponent();
     manager = MainWindow.Instance.assemblyListManager;
 }
Esempio n. 12
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;
        }