Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

Creating WPF app without a starting window MainWindow.xaml

I have looked at various posts on various forums regarding creating a WPF app without a starting a window, e.g.MainWindow.xaml. However many of them seem to be out of date with the start-up files that are created automatically, auto generated, with visual studio 17 when creating a WPF app.

If I look at the App.xaml.cs it basically contains the following, not a lot, whereas the file that contains the main method is App.g.i.cs and is shown below. For someone who is fairly new to WPF but learning quickly how can I modify the file below to prevent a start-up window appearing with my WPF app and without creating complications that may appear later when developing my project? I have removed the using statements from the code below for both files.

Any help greatly appreciated, thank you.

      namespace myApp
      {
          /// <summary>
          /// Interaction logic for App.xaml
          /// </summary>
          public partial class App : Application
          {
          }
      }

      #pragma checksum "....App.xaml" "{ff1816ec-aa5e-4d10-87f7- 
     6f4963833460}" 
      "A47028EDE65F68EA8CAF65DB3003EA3558A45109"
      //--------------------------------------------------------------------- 
     ---- 
     -----
      // <auto-generated>
      //     This code was generated by a tool.
      //     Runtime Version:4.0.30319.42000
      //
      //     Changes to this file may cause incorrect behavior and will be lost 
                if
      //     the code is regenerated.
      // </auto-generated>
      //--------------------------------------------------------------------- 
     ---- 
     -----


      namespace myApp {


          /// <summary>
          /// App
          /// </summary>
          public partial class App : System.Windows.Application {
    
              /// <summary>
              /// InitializeComponent
              /// </summary>
              [System.Diagnostics.DebuggerNonUserCodeAttribute()]
         
         
        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", 
      "4.0.0.0")]
              public void InitializeComponent() {
        
                  #line 5 "....App.xaml"
        this.StartupUri = new System.Uri("MainWindow.xaml", 
      System.UriKind.Relative);
        
        #line default
        #line hidden
    }
    
    /// <summary>
    /// Application Entry Point.
    /// </summary>
    [System.STAThreadAttribute()]
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", 
      "4.0.0.0")]
              public static void Main() {
                  myApp.App app = new myApp.App();
                  app.InitializeComponent();
                  app.Run();
              }
          }
      }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...