{"id":872,"date":"2013-01-23T23:35:48","date_gmt":"2013-01-23T12:35:48","guid":{"rendered":"http:\/\/ntsblog.homedev.com.au\/?p=872"},"modified":"2013-03-03T00:13:31","modified_gmt":"2013-03-02T13:13:31","slug":"type-yourwpfapp-app-defines-member-called-main-parameter-types","status":"publish","type":"post","link":"https:\/\/ntsblog.homedev.com.au\/index.php\/2013\/01\/23\/type-yourwpfapp-app-defines-member-called-main-parameter-types\/","title":{"rendered":"Type &#8216;YourWPfApp.App&#8217; already defines a member called &#8216;Main&#8217; with the same parameter types"},"content":{"rendered":"<div id=\"ntsbl-1190207773\" class=\"ntsbl-before-content ntsbl-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-6288941070289539\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:728px;height:90px;\" \ndata-ad-client=\"ca-pub-6288941070289539\" \ndata-ad-slot=\"9356781486\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div><h2>Create your own Custom Splash Page<\/h2>\n<p>In WPF you can really easily create a basic splash page which is just an image, but it is a bit simple for most people.<\/p>\n<p>In my application I want to display a marquee style progress bar, application version numbers that are generated off the Assembly version number, and perform any application start up, like validate a license.<\/p>\n<p>So create yourself a WPF window SplashPage.xaml and implement your layout and any custom code that should run inside the splash page.<br \/>\nImplement a timer so the window will remain open for a period of time. When the timer ticks, if all the work is done, close and dispose of the timer and then close the splash window.<\/p>\n<p>Place this code in your App.xaml.<br \/>\n[csharp]<br \/>\npublic partial class App : Application<br \/>\n{<br \/>\n\t\/\/\/ &lt;summary&gt;<br \/>\n\t\/\/\/ Application Entry Point.<br \/>\n\t\/\/\/ &lt;\/summary&gt;<br \/>\n\t[System.STAThreadAttribute()]<br \/>\n\t[System.Diagnostics.DebuggerNonUserCodeAttribute()]<br \/>\n\t[System.CodeDom.Compiler.GeneratedCodeAttribute(&quot;PresentationBuildTasks&quot;, &quot;4.0.0.0&quot;)]<br \/>\n\tpublic static void Main()<br \/>\n\t{<br \/>\n\t\tShowSplashScreen();<br \/>\n\t\tYourWpfApp.App app = new YourWpfApp.App();<br \/>\n\t\tapp.InitializeComponent();<br \/>\n\t\tapp.Run();<br \/>\n\t}<\/p>\n<p>\tprotected static void ShowSplashScreen()<br \/>\n\t{<br \/>\n\t\tSplashPage splash = new SplashPage();<br \/>\n\t\tsplash.ShowDialog();<br \/>\n\t\tsplash.Close();<br \/>\n\t}<br \/>\n}<br \/>\n[\/csharp]<\/p>\n<h2>The Problem<\/h2>\n<p>When you build the program you will get an error like:<\/p>\n<pre>Type 'YourWPfApp.App' already defines a member called 'Main' with the same parameter types<\/pre>\n<p>When you click on the error it will take you to a page App.g.cs, which contains a duplicate static Main() application entry point, that is generated by VisualStudio.<\/p>\n<h2>The Solution<\/h2>\n<ol>\n<li>Go to the properties of the App.xaml page. <\/li>\n<li>Check the Build Action. It will be &#8220;Application Definition&#8221;<\/li>\n<li>Change the build action to &#8220;Page&#8221;<\/li>\n<li>Build the application<\/li>\n<\/ol>\n<p>The application will now build. The App.g.cs file will be updated and when you look it will no longer contain the Main method.<\/p>\n<p>Cheers<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create your own Custom Splash Page In WPF you can really easily create a basic splash page which is just an image, but it is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,24],"tags":[],"class_list":["post-872","post","type-post","status-publish","format-standard","hentry","category-c","category-wpf"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=872"}],"version-history":[{"count":0,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/872\/revisions"}],"wp:attachment":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}