Git Product home page Git Product logo

weathertwentyone's Introduction

Weather '21

This is a .NET MAUI app showcasing .NET 6 Preview progress. For more information about what's included, read the blogs.

.NET MAUI Weather App on all platforms

Requirements

Setup instructions for Windows and Mac are here on the dotnet/maui wiki.

Platform Integrations

To demonstrate how easily you can enable platform-native integrations, we added a handful of features:

  • App Actions - Microsoft.Maui.Essentials provides a simple API to add shortcuts you access from the app icon
  • System Tray - added the .NET bot to the tray on Windows and status bar on macOS
  • Notifications - trigger a notification when clicking the bot

gallery of platform images

Four Platforms, One Project

The WeatherTwentyOne project is a multi-targeted SDK project that can run on Android, iOS, macOS, and Windows.

run menu

Additional Resources

https://docs.microsoft.com/dotnet/maui

https://github.com/dotnet/maui

weathertwentyone's People

Contributors

atuncer avatar davidortinau avatar friedrichrehren avatar joj avatar jsuarezruiz avatar lyalindotcom avatar mattleibow avatar pureween avatar redth avatar sweekriti91 avatar tondat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weathertwentyone's Issues

[Feature Request] Navigation in each page

Hi David,

As it's a demo app, would consider refactoring the code to have a kind of master page that would contain navigation bar?
Indeed, it shouldn't be necessary to include the nav bar in each page.
I'm new to XAML/maui and don't know how it can be implemented.

Thanks.

App crashes after 2 seconds on first open

Hello, I'm using visual studio 2022 preview 1 with .net maui preview 5 , this app crashes after few seconds on first open. Same happens from both emulator and my android device. Didn't tested ios yet. Here's the error getting in vs debugger

[] * Assertion at /__w/1/s/src/mono/mono/mini/debugger-engine.c:1088, condition `found_sp' not met
[libc] Fatal signal 6 (SIGABRT), code -6 in tid 24673 (.NET ThreadPool)

Empty main page content while running on Windows (10.0.19043)

I installed all prerequisites for .Net MAUI, the latest VS 2022 (17.0.0 Preview 2.1) and the maui-check. Everything looks good from this perspective and I can create a new maui project and run it on any platform. Nevertheless I've tried to download and run the weather app as is. While it's working fine on android, on windows (10.0.19043) it shows the first page but no content nor the menu/tabbar.

image

I see from the output that it cannot fetch a font for some reasons:

Microsoft.Maui.FontManager: Error: Error loading font 'ms-appx:///Assets/OpenSans-SemiBold.ttf'.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Runtime.InteropServices.COMException (0x80040154): Classe non enregistrée (0x80040154 (REGDB_E_CLASSNOTREG))
   at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName) in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000023+0x6e
   at WinRT.ActivationFactory`1..ctor() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000027+0x0
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x3e
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x4e
   at System.Activator.CreateInstance[T]() in System.Private.CoreLib.dll:token 0x60009a4+0x0
   at WinRT.WeakLazy`1.get_Value() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000019+0x20
   at WinRT.ActivationFactory`1.As(Guid iid) in Microsoft.Graphics.Canvas.Interop.dll:token 0x600002a+0x0
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet._ICanvasFontSetFactory..ctor() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6003792+0x1c
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x3e
   --- End of inner exception stack trace ---
   at System.RuntimeType.CreateInstanceOfT() in System.Private.CoreLib.dll:token 0x6000681+0x4e
   at System.Activator.CreateInstance[T]() in System.Private.CoreLib.dll:token 0x60009a4+0x0
   at WinRT.WeakLazy`1.get_Value() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6000019+0x20
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet._ICanvasFontSetFactory.get_Instance() in Microsoft.Graphics.Canvas.Interop.dll:token 0x6003793+0x0
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet.<>c__DisplayClass8_0.<.ctor>b__0() in Microsoft.Graphics.Canvas.Interop.dll:token 0x60037a2+0x0
   at Microsoft.Graphics.Canvas.Text.CanvasFontSet..ctor(Uri uri) in Microsoft.Graphics.Canvas.Interop.dll:token 0x6001c41+0x1a
   at Microsoft.Maui.FontManager.FindFontFamilyName(String fontFile) in Microsoft.Maui.dll:token 0x60000e0+0x3a
Microsoft.Maui.FontManager: Error: Error loading font 'ms-appx:///Assets/OpenSans-Regular.ttf'.

But even when I remove the fonts I still have the same behavior so I don't think this is related.

Any idea what could I be missing ?

Flyout icons not appearing

Menu(Shell Flyout) for Desktop/tablet not showing correctly.

image

If this code is removed, icons appers but different.

        <Shell.ItemTemplate>
            <DataTemplate>
                <Grid
                    RowDefinitions="68" HeightRequest="68">
                    <Image Source="{Binding FlyoutIcon}"
                           VerticalOptions="Center"
                           HorizontalOptions="Center"
                           />
                </Grid>
            </DataTemplate>

        </Shell.ItemTemplate>

image

Is a bug? or just is missing code?

Thanks

WindowExtensions.MinimizeToTray() method does not work

The above method does not cause any change to the app. Upon debugging I noticed that the window handle Hwnd is always IntPtr.Zero. I was able to to however make it work with the below code :-

.
.
Hwnd = ((MauiWinUIWindow)App.Current.Windows[0].Handler.PlatformView).WindowHandle;
.
.

Is it the correct way or am I missing something here? All my setup are according to the latest official docs.

Error running the sample WeatherTwentyOne project

Hello everyone,

sorry about my question, but I got many issues when I tried to run the WeatherTwentyOne project, I missed something for sure... can help? I would like to run for now using Android Platform. Maybe I am confuse, and I should run dotnet commands to update something, not sure...

Severity Code Description Project File Line Suppression State
Error NETSDK1045 The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. WeatherTwentyOne.WinUI C:\Program Files\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 141

Severity Code Description Project File Line Suppression State
Error NETSDK1139 The target platform identifier android was not recognized. WeatherTwentyOne C:\Program Files\dotnet\sdk\5.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 109

See the image:

image

Question: File duplication?

Hello,
I am just wondering why files are duplicated between WeatherTwentyOne and WeatherTwentyOne.WinUI3 projects? I believe it could be a single project containing IOS/Android/MacCatalyst/WinUI3 or am I wrong?

Question: Three different png images are references in xaml an code but does not exist in solution?

I see several references to .png images, in for example App.xaml:

<!-- Desktop/Tablet-->
<FlyoutItem Title="Home" Icon="tab_home.png">
    <ShellContent ContentTemplate="{DataTemplate page:HomePage}"/>
</FlyoutItem>
<FlyoutItem Title="Favorites" Icon="tab_favorites.png">
    <ShellContent ContentTemplate="{DataTemplate page:FavoritesPage}"/>
</FlyoutItem>
<FlyoutItem Title="Map" Icon="tab_map.png">
    <ShellContent ContentTemplate="{DataTemplate page:MapPage}"/>
</FlyoutItem>
<FlyoutItem Route="settings" Icon="tab_map.png" >
    <ShellContent ContentTemplate="{DataTemplate page:SettingsPage}"/>
</FlyoutItem>

<!-- Phone -->
<TabBar x:Name="PhoneTabs">
    <Tab Title="Hem" Icon="tab_home.png">
        <ShellContent ContentTemplate="{DataTemplate page:HomePage}"/>
    </Tab>
    <Tab Title="Favorites" Icon="tab_favorites.png">
        <ShellContent ContentTemplate="{DataTemplate page:FavoritesPage}"/>
    </Tab>
    <Tab Title="Map" Icon="tab_map.png">
        <ShellContent ContentTemplate="{DataTemplate page:MapPage}"/>
    </Tab>
    <Tab Title="Settings" Icon="tab_settings.png">
        <ShellContent ContentTemplate="{DataTemplate page:SettingsPage}"/>
    </Tab>
</TabBar>

But, when I try to find those image files in the solution, I can't find them - there are no tab_home.png, tab_favorites.png or tab_map.png. However, in Resources/Images I find the .svg versions:

  • Resources/Images/tab_home.svg
  • Resources/Images/tab_favorites.svg
  • Resources/Images/tab_map.svg

Also in the \src\WeatherTwentyOne\Converters\ActiveTabConverter.cs, the png files are references (as hardcoded strings).

So, what am I missing here? How can the application display the icons (cause they are displayed correctly) when the file names are wrong?

Add the web

How would you change your solution to also add the web as a target, the only missing target for a enterprise solution? One code for ALL platforms ;)
Great work so far. I love it. I am quite excited about the new Maui

"Access to the path '/data/fonts' is denied."

When running this project , running on Samsung S21 via USB debug mode

{System.UnauthorizedAccessException: Access to the path '/data/fonts' is denied. ---> System.IO.IOException: Permission denied --- End of inner exception stack trace --- at System.IO.Enumeration.FileSystemEnumerator1[[System.IO.FileInfo, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator1[[System.IO.FileInfo, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Init() at System.IO.Enumeration.FileSystemEnumerator1[[System.IO.FileInfo, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(String directory, Boolean isNormalized, EnumerationOptions options) at System.IO.Enumeration.FileSystemEnumerable1.DelegateEnumerator[[System.IO.FileInfo, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(FileSystemEnumerable1 enumerable, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerable1[[System.IO.FileInfo, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized) at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at System.IO.DirectoryInfo.GetFiles(String searchPattern, EnumerationOptions enumerationOptions) at System.IO.DirectoryInfo.GetFiles() at Microsoft.Maui.Graphics.Native.NativeFontService.InitializeFonts() in D:\a\1\s\src\Microsoft.Maui.Graphics\Android\NativeFontService.cs:line 172 at Microsoft.Maui.Graphics.Native.NativeFontService.GetFontFamilies() in D:\a\1\s\src\Microsoft.Maui.Graphics\Android\NativeFontService.cs:line 43 at Microsoft.Maui.Graphics.AbstractFontService.GetFontStyleById(String id) in D:\a\1\s\src\Microsoft.Maui.Graphics\AbstractFontService.cs:line 70 at Microsoft.Maui.Graphics.Native.NativeFontService.GetTypeface(String name) in D:\a\1\s\src\Microsoft.Maui.Graphics\Android\NativeFontService.cs:line 281 at Microsoft.Maui.Graphics.Native.NativeCanvas.CreateNewState(Object context) in D:\a\1\s\src\Microsoft.Maui.Graphics\Android\NativeCanvas.cs:line 46 at Microsoft.Maui.Graphics.AbstractCanvas1[[Microsoft.Maui.Graphics.Native.NativeCanvasState, Microsoft.Maui.Graphics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]..ctor(Func2 createNew, Func2 createCopy) in D:\a\1\s\src\Microsoft.Maui.Graphics\AbstractCanvas.cs:line 36 at Microsoft.Maui.Graphics.Native.NativeCanvas..ctor(Context context) in D:\a\1\s\src\Microsoft.Maui.Graphics\Android\NativeCanvas.cs:line 21 at Microsoft.Maui.Graphics.Native.NativeGraphicsView..ctor(Context context, IDrawable drawable) in D:\a\1\s\src\Microsoft.Maui.Graphics\Android\NativeGraphicsView.cs:line 28 at Microsoft.Maui.MauiShapeView..ctor(Context context) in D:\a\1\s\src\Core\src\Platform\Android\MauiShapeView.cs:line 8 at Microsoft.Maui.Handlers.ShapeViewHandler.CreateNativeView() in D:\a\1\s\src\Core\src\Handlers\ShapeView\ShapeViewHandler.Android.cs:line 8 at Microsoft.Maui.Handlers.ViewHandler2[[Microsoft.Maui.IShapeView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.MauiShapeView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].OnCreateNativeView() in D:\a\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 70 at Microsoft.Maui.Handlers.ViewHandler.OnCreateNativeElement() in D:\a\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 118 at Microsoft.Maui.Handlers.ElementHandler.CreateNativeElement() in D:\a\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 96 at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 52 at Microsoft.Maui.Handlers.ViewHandler2[[Microsoft.Maui.IShapeView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.MauiShapeView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IView view) in D:\a\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 51 at Microsoft.Maui.Handlers.ViewHandler2[[Microsoft.Maui.IShapeView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.MauiShapeView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 54 at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Element.Impl.cs:line 62 at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Element.Impl.cs:line 18 at Microsoft.Maui.HandlerExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 62 at Microsoft.Maui.HandlerExtensions.ToNative(IElement view, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 35 at Microsoft.Maui.Controls.Platform.ShellContentView.OnViewSet(View view) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellContentView.cs:line 207 at Microsoft.Maui.Controls.Platform.ShellContentView.set_View(View value) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellContentView.cs:line 46 at Microsoft.Maui.Controls.Platform.ShellContentView..ctor(Context context, View view, IMauiContext mauiContext) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellContentView.cs:line 38 at Microsoft.Maui.Controls.Platform.ShellContainerView.OnViewSet(View view) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellContainerView.cs:line 153 at Microsoft.Maui.Controls.Platform.ShellContainerView.set_View(View value) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellContainerView.cs:line 38 at Microsoft.Maui.Controls.Platform.ShellContainerView..ctor(Context context, View view, IMauiContext mauiContext) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellContainerView.cs:line 20 at Microsoft.Maui.Controls.Platform.ShellFlyoutTemplatedContentView.HeaderContainer..ctor(Context context, View view, IMauiContext mauiContext) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellFlyoutTemplatedContentView.cs:line 514 at Microsoft.Maui.Controls.Platform.ShellFlyoutTemplatedContentView.UpdateFlyoutHeader() in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellFlyoutTemplatedContentView.cs:line 231 at Microsoft.Maui.Controls.Platform.ShellFlyoutTemplatedContentView.LoadView(IShellContext shellContext) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellFlyoutTemplatedContentView.cs:line 76 at Microsoft.Maui.Controls.Platform.ShellFlyoutTemplatedContentView..ctor(IShellContext shellContext) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellFlyoutTemplatedContentView.cs:line 55 at Microsoft.Maui.Controls.Platform.ShellView.CreateShellFlyoutContentView() in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellView.cs:line 134 at Microsoft.Maui.Controls.Platform.ShellView.Microsoft.Maui.Controls.Platform.IShellContext.CreateShellFlyoutContentView() in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellView.cs:line 44 at Microsoft.Maui.Controls.Platform.ShellFlyoutView.AttachFlyout(IShellContext context, View content) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellFlyoutView.cs:line 180 at Microsoft.Maui.Controls.Platform.ShellFlyoutView.Microsoft.Maui.Controls.Platform.IShellFlyoutView.AttachFlyout(IShellContext context, View content) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellFlyoutView.cs:line 64 at Microsoft.Maui.Controls.Platform.ShellView.OnElementSet(Shell shell) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellView.cs:line 212 at Microsoft.Maui.Controls.Platform.ShellView.SetVirtualView(Shell shell) in D:\a\1\s\src\Controls\src\Core\Platform\Android\Shell\ShellView.cs:line 189 at Microsoft.Maui.Controls.Handlers.ShellHandler.SetVirtualView(IView view) in D:\a\1\s\src\Controls\src\Core\Handlers\Shell\ShellHandler.Android.cs:line 24 at Microsoft.Maui.Handlers.ViewHandler2[[Microsoft.Maui.Controls.Shell, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Controls.Platform.ShellFlyoutView, Microsoft.Maui.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetVirtualView(IElement view) in D:\a\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 54 at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Element.Impl.cs:line 62 at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Element.Impl.cs:line 18 at Microsoft.Maui.HandlerExtensions.ToHandler(IElement view, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 62 at Microsoft.Maui.HandlerExtensions.ToNative(IElement view, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 35 at Microsoft.Maui.ContainerView.SetView(IElement view, Boolean forceRefresh) in D:\a\1\s\src\Core\src\Platform\Android\ContainerView.cs:line 72 at Microsoft.Maui.ContainerView.set_CurrentView(IElement value) in D:\a\1\s\src\Core\src\Platform\Android\ContainerView.cs:line 51 at Microsoft.Maui.HandlerExtensions.ToContainerView(IElement view, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 31 at Microsoft.Maui.Controls.Window.MapContent(WindowHandler handler, IWindow view) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Window\Window.cs:line 41 at Microsoft.Maui.PropertyMapper2.<>c__DisplayClass5_0[[Microsoft.Maui.IWindow, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Handlers.WindowHandler, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].b__0(IElementHandler h, IElement v) in D:\a\1\s\src\Core\src\PropertyMapper.cs:line 163 at Microsoft.Maui.PropertyMapper.UpdatePropertyCore(String key, IElementHandler viewHandler, IElement virtualView) in D:\a\1\s\src\Core\src\PropertyMapper.cs:line 35 at Microsoft.Maui.PropertyMapper.UpdateProperties(IElementHandler viewHandler, IElement virtualView) in D:\a\1\s\src\Core\src\PropertyMapper.cs:line 70 at Microsoft.Maui.Handlers.ElementHandler.SetVirtualView(IElement view) in D:\a\1\s\src\Core\src\Handlers\Element\ElementHandler.cs:line 74 at Microsoft.Maui.Controls.Element.SetHandler(IElementHandler newHandler) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Element.Impl.cs:line 62 at Microsoft.Maui.Controls.Element.set_Handler(IElementHandler value) in D:\a\1\s\src\Controls\src\Core\HandlerImpl\Element.Impl.cs:line 18 at Microsoft.Maui.HandlerExtensions.SetHandler(Context nativeElement, IElement element, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 94 at Microsoft.Maui.HandlerExtensions.SetWindowHandler(Activity activity, IWindow window, IMauiContext context) in D:\a\1\s\src\Core\src\Platform\Android\HandlerExtensions.cs:line 74 at Microsoft.Maui.Platform.ApplicationExtensions.CreateNativeWindow(Activity activity, IApplication application, Bundle savedInstanceState) in D:\a\1\s\src\Core\src\Platform\Android\ApplicationExtensions.cs:line 27 at Microsoft.Maui.MauiAppCompatActivity.OnCreate(Bundle savedInstanceState) in D:\a\1\s\src\Core\src\Platform\Android\MauiAppCompatActivity.cs:line 31 at WeatherTwentyOne.MainActivity.OnCreate(Bundle savedInstanceState) in D:\github\davidortinau\WeatherTwentyOne\src\WeatherTwentyOne\Platforms\Android\MainActivity.cs:line 15 at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_(IntPtr

Compilation Errors

Installed all the latest previews, maui-check runs fine, but when i try and build i get the following errors...
image
I have just created a new project from template and the new one doesn't have a startup file, has something changed?

WinUI Types not resolvable

thanks for providing this sample here.

after a manual "update-pacakge" i was able to resolve all nuget package references.
when i want to build i get the following error:

WMC1007 Cannot resolve metadata for WinUI types. Please ensure that Nuget Restore was successful. WeatherTwentyOne C:\source_prototypes\WeatherTwentyOne-dev-rc\src\WeatherTwentyOne\WeatherTwentyOne.csproj 1

i tried: clean, rebuild, reload project

App does not take full screen

I cloned the repo then launch the application on multiple emulators (IPhone Pro 12, IPhone 12) and on my own device (IPhone 11 Pro) and the application does not render as in the screenshots.
The application does not take the full screen as the following pictures shows.

Screenshot 2021-05-27 at 19 24 10

I'm on Mac and I'm using this command to launch the application:

dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=<UDID>
// My own device
dotnet build -t:Run -f net6.0-ios -r ios-arm64 -p:_DeviceName=<UDID>

errors regardless of workloads and packages and ide

hi I'm somewhat newbie to maui and blazor -shell
I'm trying to open this repo with both vs 2019 and 2022 preview but no luck errors arise from both consoles output .

I installed all workloads unfortunately VS19 doesn't have MAUI component nor .net 6 even after update ... I tried to force installment using CLI it's says it has installed but it seems doesn't I've already installed multiple versions of .net 6 and all workloads ,some plugins but errors of vs2019 :

Severity Code Description Project File Line Suppression State Error Improper project configuration: no AppxManifest is specified, but WindowsPackageType is not set to MSIX. WeatherTwentyOne.WinUI
also doesn't detect .net 6 sdk and maui installed through cli
cmd19
maui

Severity Code Description Project File Line Suppression State Error NU1012 Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android, net6.0-ios, net6.0-maccatalyst WeatherTwentyOne C:\Users\hi\Desktop\demo\MAUI\src\WeatherTwentyOne\WeatherTwentyOne.csproj 1
Severity Code Description Project File Line Suppression State Error NETSDK1045 The current .NET SDK does not support targeting .NET 6.0. Either target .NET 5.0 or lower, or use a version of the .NET SDK that supports .NET 6.0. WeatherTwentyOne.WinUI C:\Program Files\dotnet\sdk\5.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 141
I spent some time installing 2022 with all required workloads and followed the installment instructions ;

2022

Setting visibility of FlyoutItem to invisible results in a crash

I am new to Maui and I need to create an app where tab visibility depends on the user data/rights. So I began to study this sample project.

I made the following change to App.xml: (added x:Name="tabFav" IsVisible="False")

<FlyoutItem Title="Favorites" Icon="tab_favorites.png" x:Name="tabFav" IsVisible="False"> <ShellContent ContentTemplate="{DataTemplate page:FavoritesPage}"/> </FlyoutItem>

and changed in App.xaml.cs:

void TapGestureRecognizer_Tapped(System.Object sender, System.EventArgs e) { Shell.Current.GoToAsync("///settings"); tabFav.IsVisible = !tabFav.IsVisible; }

Setting tabFav to visible works but setting to invisible results in unhandled exception when running app in Windows

Errors when compiling app. Issues with MyGet.

When I try to run the app using Visual Studio 2019 16.11 Preview 2, I get the error below. What's the issue with MyGet?

Failed to restore G:\files\WeatherTwentyOne-main\WeatherTwentyOne-main\src\WeatherTwentyOne\WeatherTwentyOne.csproj (in 2 ms).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.Toolkit.Uwp.Notifications'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.ProjectReunion.WinUI'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.Maui'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.User32'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.ProjectReunion'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.ProjectReunion.Foundation'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.ProjectReunion.WinUI'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.Toolkit.Uwp.Notifications'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.Maui'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.User32'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.ProjectReunion'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Microsoft.ProjectReunion.Foundation'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Kernel32'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Windows.Core'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Windows.ShellScalingApi'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Validation'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Kernel32'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Windows.Core'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Windows.ShellScalingApi'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
Retrying 'FindPackagesByIdAsyncCore' for source 'http://api.myget.org/FindPackagesById()?id='Validation'&semVerLevel=2.0.0'.
Response status code does not indicate success: 404 (Not Found).
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
1>------ Rebuild All started: Project: WeatherTwentyOne.WinUI, Configuration: Debug Any CPU ------
2>------ Rebuild All started: Project: WeatherTwentyOne, Configuration: Debug Any CPU ------
Error occurred while restoring NuGet packages: Failed to retrieve information about 'PInvoke.Windows.ShellScalingApi' from remote source 'http://api.myget.org/FindPackagesById()?id='PInvoke.Windows.ShellScalingApi'&semVerLevel=2.0.0'.
2>C:\Program Files\dotnet\sdk\6.0.100-preview.5.21302.13\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(33,5): error NETSDK1147: To build this project, the following workloads must be installed: microsoft-android-sdk-full
2>C:\Program Files\dotnet\sdk\6.0.100-preview.5.21302.13\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(33,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload install microsoft-android-sdk-full
2>Done building project "WeatherTwentyOne.csproj" -- FAILED.

Failed to launch WinUI3 project on Windows 10

I can build WinUI3 successfully, but when I launch it with debug, I got the following exception:

System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=System.Private.CoreLib
  StackTrace:
   at System.RuntimeType.CreateInstanceOfT()
   at System.Activator.CreateInstance[T]()
   at WinRT.WeakLazy`1.get_Value()
   at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance()
   at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
   at WeatherTwentyOne.WinUI.Program.Main(String[] args) in C:\Users\wangq\development\WeatherTwentyOne\src\WeatherTwentyOne.WinUI3\obj\x64\Debug\net6.0-windows10.0.19041\Windows\WindowsApp.g.i.cs:line 26

COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))

Windows 10 build version: 19042.985

Error building for Windows platform

DEP0700: Registration of the app failed. [0x80073CF6] AppxManifest.xml(33,27): errore 0x80070003: impossibile installare o aggiornare il pacchetto BA0275D4-73C9-4F0C-BF53-CAC4FAD28D12_9zz4h110yvjzm. Non è possibile individuare l'immagine [appiconfgSplashScreen.png] della schermata iniziale. Verificare che il pacchetto contenga un'immagine utilizzabile come schermata iniziale per l'applicazione e che il manifesto del pacchetto faccia riferimento alla posizione corretta all'interno del pacchetto in cui trovare l'immagine.

TapGestureRecognizer is not working for IOS

It seems that this sample was not tested at IOS, as all TapGestureRecognizer click were not working at all in IOS. (IPhone)
I have lasted Visual Studio version, VS2022 PRO 17.1.0 Preview 2.0, .

Preview 14 - Windows build looks for Assets fold when there isn't one

This demo built and worked fine with Preview 13 on Android, iOS and Windows. However with Preview 14 it won't build for Windows because it is looking for appiconfgSplashScreen.png in the Assets folder. There is no Assets folder. What I did was remove the reference under the Windows platform folder in the Package.appxmanifest file under uap:VisualElements. Then it built and ran.

<Applications> <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$"> <uap:VisualElements/> </Application> </Applications>

[Question] Windows tray icon

I see that to add the Windows Tray Icon you had to do a lot of Native Windows code to get it implemented, is this something that will change in the future? or should I go ahead and do that in my application?

[Suggestion] Move `<Shell>` XAML out of App.XAML into its own class.

Yesterday I tried to help an SO MAUI question where a person tried to pull <TabBar x:Name="PhoneTabs">... into their own MAUI App class, then work with those elements in App.xaml.cs.

Not surprisingly, they weren't succeeding: They were attempting something that would only work within a Shell PAGE, not the APP.

Seeing this, I suggest that the example might be a more useful starting point if the "page" XAML was a separate class, with its own code behind.


(I would link to the question, but it has been removed. Based on a comment OP made just before removing it, they became upset and thought that I was (criticizing? insulting? not sure) what they attempted. Whereas what I intended to convey is that a) MAUI isn't ready yet to work with, unless one is already an experienced Xamarin Forms developer (who would have understood my comment suggesting they make this code refactoring before continuing), and b) that WeatherTwentyOne example had caused this confusion by making it seem (at first glance, to someone not well-versed in XAML and XF) that these elements were part of the App class, whereas they are actually part of Shell, which is a Page.)

Start the Window App?

I'm feeling quite foolish about this, being a long-time VS/.NET dev, but I haven't figured out how to launch the Windows version of the app. What am I missing? I've set "WeatherTwentyOne.WinUI" as my startup project, and when I attempt to run the project I get "Unable to start debugging. The startup project cannot be launched. ..."

Admittedly I'm very new to Maui (this is my first attempt even to look at a Maui app), but....

Error CS0103 'InitializeComponent' does not exist in the current context

If I clone the repo (as of the time of this issue), and I open it up in Visual Studio 2022 17.1.0 Preview 3, with maui-check executed and passed, I get The name <yada yada> does not exist in the current context for any class that has an InitializeComponent method, including App.xaml.cs

UPDATE

  • I just discovered that it actually builds anyway, "Build succeeded"
  • Deploy to emulator (Android) fails on my computer, for now, but I managed to deploy it to device! =)
Error	CS0103	
The name 'InitializeComponent' does not exist in the current context	
WeatherTwentyOne (net6.0-android), WeatherTwentyOne (net6.0-ios), WeatherTwentyOne (net6.0-maccatalyst), WeatherTwentyOne (net6.0-windows10.0.19041)	
C:\Git\Maui\WeatherTwentyOne\src\WeatherTwentyOne\Pages\FavoritesPage.xaml.cs	9	Active


Error	CS0103	The name 'InitializeComponent' does not exist in the current context	
WeatherTwentyOne (net6.0-android), WeatherTwentyOne (net6.0-ios), WeatherTwentyOne (net6.0-maccatalyst), WeatherTwentyOne (net6.0-windows10.0.19041)	
C:\Git\Maui\WeatherTwentyOne\src\WeatherTwentyOne\Views\CurrentWidget.xaml.cs	7	Active


Error	CS0103	The name 'InitializeComponent' does not exist in the current context	
WeatherTwentyOne (net6.0-android), WeatherTwentyOne (net6.0-ios), WeatherTwentyOne (net6.0-maccatalyst), WeatherTwentyOne (net6.0-windows10.0.19041)
C:\Git\Maui\WeatherTwentyOne\src\WeatherTwentyOne\Views\WidgetsPanel.xaml.cs	7	Active

Error	CS0103	The name 'PhoneTabs' does not exist in the current context	
WeatherTwentyOne (net6.0-android), WeatherTwentyOne (net6.0-ios), WeatherTwentyOne (net6.0-maccatalyst), WeatherTwentyOne (net6.0-windows10.0.19041)	
C:\Git\Maui\WeatherTwentyOne\src\WeatherTwentyOne\App.xaml.cs	14	Active

image

This is the log of maui-check:

☼ .NET MAUI Check v0.10.0.0 ☼
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
This tool will attempt to evaluate your .NET MAUI development environment.
If problems are detected, this tool may offer the option to try and fix them for you, or suggest a way to fix them
yourself.

Thanks for choosing .NET MAUI!
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
» Synchronizing configuration... ok
» Scheduling appointments... ok

> OpenJDK 11.0 Checkup...
  - 11.0.12 (C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\..)
  - 1.8.0-25 (C:\Program Files\Android\Jdk\microsoft_dist_openjdk_1.8.0.25)

> Visual Studio 17.1.0-pre.3.0 Checkup...
  - 17.0.0
  - 17.1.0-pre.3.0 - C:\Program Files\Microsoft Visual Studio\2022\Preview
  - 16.11.1

> Android SDK Checkup...
  - emulator (31.1.4)
  - build-tools;31.0.0 (31.0.0)
  - platforms;android-31 (1)
  - system-images;android-31;google_apis;x86_64 (8)
  - platform-tools (31.0.3)
  - cmdline-tools;5.0 (5.0)

> Android Emulator Checkup...
  - Emulator: pixel_2_pie_9_0_-_api_28 found.

> .NET SDK Checkup...
  - 3.1.300 - C:\Program Files\dotnet\sdk\3.1.300
  - 5.0.400 - C:\Program Files\dotnet\sdk\5.0.400
  - 6.0.100-preview.3.21202.5 - C:\Program Files\dotnet\sdk\6.0.100-preview.3.21202.5
  - 6.0.100 - C:\Program Files\dotnet\sdk\6.0.100
  - 6.0.200-preview.22055.15 - C:\Program Files\dotnet\sdk\6.0.200-preview.22055.15

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
☼ Recommendation: Download .NET SDK (6.0.200)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

I did not download .NET SDK (6.0.200).

MacOS setup guide needed.

Hello, having trouble setting up MAUI on MacOS.
I don't wan't t install whole Android SDK (not interested really).
maui-check ran fine for me, excluding Android SDK.

Could you please introduce manual for MacOS either Visual Studio or Visual Studio Code?

Preview7 & PInvoke

Hi Team,

when compiling in my MSVS 17 preview 3.1, I get a compilation error that PInvoke.User32 cannot be found. Could it be fixed?

Thank you

Deployment error

I cloned the project and ran it with the newest everything 16.11.0. I get the following deployment error. Any ideas?:

DEP1700: The recipe file "C:\Users\xhor606\source\repos\MauiWeatherApp\src\WeatherTwentyOne.WinUI3 (Package)\bin\x86\Debug\WeatherTwentyOne.WinUI3 (Package).build.appxrecipe" does not exist. You may need to build your project. WeatherTwentyOne.WinUI3 (Package)

Flyout is not appearing correctly on Windows or Android

After I updated the csproj file and removed the ItemSizingStrategy="MeasureFirstItem" from the CollectionView in WidgetsPanel (because ItemSizingStrategy causes the Android version to exit on startup), I noticed the Flyout only shows the Settings Icon on Windows and Android.
With some fiddling around with Styles and VisualStateManager, I could get the FlyoutItems to appear on the Windows version. However I was never able to get them to show on the Android.
I tested the Android app on a Galaxy Tab S7.

Is Visual Studio necesseary? (how to avoid vendor lock-in)

I have production experience with React Native. Mobile development is fun but React Native has some issues. .NET MAUI seems like a good alternative although I am a bit confused by the lack of documentation and tutorials.

My main problem right now is that every learning resource that I found forces me to use Visual Studio. I know that for Android / iOS development I usually need to use official IDEs. However, when it comes to cross-platform development I would expect more freedom. For example what if I want to use Rider for the development? What if I want to use VSCode? (I noticed that the author of this repository used VSCode)

Is there any CLI tool available? Could you please point me in the right direction?

Example:

  • With React Native I can run iOS applications on MacOS with the following command: npx react-native run-ios I can also specify the device.
  • With React Native I can run Android applications on MacOS with the following command: npx react-native run-ios. Honestly, I am not sure if I even need Android Studio. I think I do for the build but when it comes to emulator I can use Genymotion instead of Android Studio. How do I run .NET MAUI application with Genymotion?

Thank you. Any additional learning resources would be highly appreciated. Especially anything that isn't locked in the Windows ecosystem. 🙌

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.