@@ -56,32 +56,37 @@ public ClassNode CurrentClassNode
5656 }
5757 }
5858
59+ private void UpdateWindowTitle ( string extra = null )
60+ {
61+ var title = $ "{ ( Program . Settings . RandomizeWindowTitle ? Utils . RandomString ( Program . GlobalRandom . Next ( 15 , 20 ) ) : Constants . ApplicationName ) } ({ Constants . Platform } )";
62+ if ( ! string . IsNullOrEmpty ( extra ) )
63+ {
64+ title += $ " - { extra } ";
65+ }
66+ Text = title ;
67+ }
68+
5969 public MainForm ( )
6070 {
6171 Contract . Ensures ( pluginManager != null ) ;
6272 Contract . Ensures ( currentProject != null ) ;
6373
6474 InitializeComponent ( ) ;
65-
66- string randomWindowTitle = Utils . RandomString ( Program . GlobalRandom . Next ( 15 , 20 ) ) ;
67-
68- Text = $ "{ ( Program . Settings . RandomizeWindowTitle ? randomWindowTitle : Constants . ApplicationName ) } ({ Constants . Platform } )";
75+ UpdateWindowTitle ( ) ;
6976
7077 mainMenuStrip . Renderer = new CustomToolStripProfessionalRenderer ( true , true ) ;
7178 toolStrip . Renderer = new CustomToolStripProfessionalRenderer ( true , false ) ;
7279
7380 Program . RemoteProcess . ProcessAttached += sender =>
7481 {
75- string randomWindowTitle = Utils . RandomString ( Program . GlobalRandom . Next ( 15 , 20 ) ) ;
7682 var text = $ "{ sender . UnderlayingProcess . Name } (ID: { sender . UnderlayingProcess . Id . ToString ( ) } )";
77-
78- Text = $ "{ ( Program . Settings . RandomizeWindowTitle ? randomWindowTitle : Constants . ApplicationName ) } ({ Constants . Platform } ) - { text } ";
7983 processInfoToolStripStatusLabel . Text = text ;
84+ UpdateWindowTitle ( text ) ;
85+
8086 } ;
8187 Program . RemoteProcess . ProcessClosed += sender =>
8288 {
83- string randomWindowTitle = Utils . RandomString ( Program . GlobalRandom . Next ( 15 , 20 ) ) ;
84- Text = $ "{ ( Program . Settings . RandomizeWindowTitle ? randomWindowTitle : Constants . ApplicationName ) } ({ Constants . Platform } )";
89+ UpdateWindowTitle ( ) ;
8590 processInfoToolStripStatusLabel . Text = "No process selected" ;
8691 } ;
8792
0 commit comments