.tree
.tree
CC#
Created by .tree on 2/7/2024 in #help
MAUI - Package upgrade to .NET 8
No description
1 replies
CC#
Created by .tree on 1/16/2024 in #help
(Xamarin.Forms) Setting DataTemplate for view with DataTrigger
Here is my XAML: https://paste.ofcode.org/yAqAF7mfcjfgimjNsvP9ny My goal is this: This view has data context SortCondition. I want to set the datatemplate that I defined in resources based on a property in SortCondition (AnotherCondtion, which is of type SortCondition itself). When it's set to an object I want to display the datatemplate SortAttributeConditionTemplate, but it doesnt show anything. What am I doing wrong?
4 replies
CC#
Created by .tree on 1/11/2024 in #help
Make a view include itself
I have a view in Xamarin consisting of a picker and a button. Depending on the value in the picker I want to show this view again in place of the button (Grid.Row = 1). Just putting a <views:MyView> inside of MyView obviously just leads to infinite recursion and my app crashes. What is the correct way to go about this? MyView.xaml: <ContentView.Content> <Grid [...]> <controls:SinglePicker Grid.Row = 0 [...] /> <controls:XButton Grid.Row = 1 [...] /> </Grid> </ContentView.Content>
3 replies
CC#
Created by .tree on 9/7/2023 in #help
❔ XAML nested View, Parent is null?
I have one view inside another. In the inner view I use Parent.Parent.Paren. etc to the point of reaching the outer view. However once I reach the "end" of the inner view, Parent returns null. I have trouble seeing why that happens and what alternative I have.
11 replies
CC#
Created by .tree on 8/28/2023 in #help
❔ XAML accessing property of parent views element
I have this structure in XAML: <RelativeLayout> <Grid1> <tabView> <tabView.Item> <MyView> <Grid2> <MyView2 x:Name="MyView2" IsVisible = false> In the code behind of MyView I want to set MyView2's IsVisible property to true on a button click. I tried it using Parent.Parent.Parent.Parent.FindByName<MyView2>("MyView2").IsVisible = true; but couldnt get anything to show on button press.
8 replies
CC#
Created by .tree on 8/15/2023 in #help
❔ Xamarin XAML - Contents of grid inside TabViewItem not visible
In XAML for Xamarin I want to have a TabView with 2 tabs. I tried adding a grid to one of these tabs which contains a FlexLayout with a button. However the content of the tab is not visible when I compile. Can anyone tell me what I'm missing? https://pastebin.com/621KmtwV
3 replies
CC#
Created by .tree on 8/8/2023 in #help
❔ Access a DB property from a not mapped property
I have 2 models, A and B. A includes a property X that I want to store in property Y in B. Property X is stored in a DB, property Y is not mapped. How can I achieve this? Simply doing get => A.X does not seem to work in property Y
19 replies
CC#
Created by .tree on 4/16/2023 in #help
❔ Issues in Repository pattern with defining Common Code
Code: https://paste.mod.gg/ybmdfcjlyxwg/0 Situation: In my code there are multiple implementations that do stuff depending on the underlying DB. Some of those DBs are open source (GeodatabasePostGIS), some are proprietary (GeodatabaseArcObjects). Because they both share some code, I made an abstract class that both inherit from (GeodatabaseAbstract). Since all open source DBs would also share specific code, I defined another abstract class only for them that inherits from GeodatabaseAbstract (GeodatabaseOpenSource). GeodatabaseAbstract implements an interface. Goal: I want to make those common code functions available to the methods of the implementations, but I cant seem to figure it out. I tried making a sort of wrapper for the abstract methods in GeodatabaseAbstract, but then I get issue regarding protection levels. Since GeodatabaseAbstract implements the Interface, I can't change the abstracts methods to anything other than public.
31 replies
CC#
Created by .tree on 4/4/2023 in #help
❔ Nettopologysuite - What datasources are supported? How to query data?
Can I use Nettopologysuite (https://github.com/NetTopologySuite/NetTopologySuite) to retrieve data from my Database (for example postgis) or is it only for working with the data that I retrieved myself (by using SQL or an ORM)? I can't find any examples where the datasource is accessed directly, and I was wondering if there is some sort of abstract way to query data regardless of the underlying datasource (be it postgis, mysql, shapefiles, ...).
2 replies
CC#
Created by .tree on 3/20/2023 in #help
❔ Circular dependency between projects
I have 3 projects: 1. Library 2. REST API 3. Windows service The service is supposed to host the API. Both the API and service depend on the library. The service depends on the API so it knows to run it. Problem: The API also depends on the service, as there is one property P in service.classA it uses, causing a circular dependency. P is an object library.Interfaces.I. I'm unsure how to resolve this. Just putting classA into the library doesn't work, as classA also depends on a model service.Models.M. I guess I could put M in the library too, but is that a good approach?
117 replies
CC#
Created by .tree on 3/13/2023 in #help
❔ NSwag Client generation
I'm trying to generate an API client for my .NET 6 REST API that used to be a Soap service. I want to replace the generated soap client with a new REST client. When I generate an API Client in NSwag Studio, I get only a single file with a bunch of methods that aren't named after my API calls. What is this for? When I generate using the swagger editor online, I do receive an API file as well as multiple model classes that are named after my objects and methods. I'm confused as to why I get these different results and which one is needed for what task.
10 replies
CC#
Created by .tree on 3/13/2023 in #help
❔ Circular dependency between projects
I migrated an old project to .NET 6 from .Net Framework. The application is a REST service running on a windows service. In the old version, both of those were in a single project. With .NET 6 however I decided to split them into a Web API project for the REST service and a Windows Worker Service project for the Windows service, as that seems to be the best practice. Now I have the issue of the REST project depending on the Windows Service project and vice versa. How do I deal with this?
4 replies
CC#
Created by .tree on 3/9/2023 in #help
❔ Generate REST Client with NSwag Studio
When I generate a C# Client for my REST API using swaggers online editor-next, I get a .NET Project with multiple cs files for my models and clients. However when I use Nswag Studio with the same Swaggerfile, I only get one single .cs file. Why is this? The issue with the client generated from the editor is that it's not .NET 6, which I need for my application.
2 replies
CC#
Created by .tree on 2/14/2023 in #help
❔ Swagger file Error "Can't have Request Body in GET"
I created a REST Api in an ASP.NET API Project. There I have a controller with a few GET methods. When I take the swagger JSON file and paste it into the swagger editor I get errors on some GET methods "GET operations cannot have a requestBody.". I didn't specify a request body in any way. Since the swagger file was created by swagger, why did it put a request body there if there shouldn't be on in a GET method? Or is there another reason the request body is there?
2 replies
CC#
Created by .tree on 2/13/2023 in #help
❔ Rewrite .NET Framework 4.5.1 SOAP client to REST in .NET 6
I have this SOAP web service that I rewrote to REST. That part wasn't so hard, but now I have to rewrite the SOAP client part. From what I can tell, it's super long .cs that was generated based on two .wsdl files. How do I approach this, do I just throw away the .wsdl files and rewrite the whole thing? I only ever called a REST API in some demo application, how would a best practice real world example look like?
32 replies
CC#
Created by .tree on 1/31/2023 in #help
❔ Models for JSON from API
In Tim Coreys video he had an API with this sort of JSON structure: results: sunrise: "value" sunset: "value" For this he created two models, one for the actual keys called SunModel, and one for the results, which has a field of type SunModel called Results. Now I have this API that I want to call: times: 2023-10-29: 0: "value" 1: "value" So I have one more layer, what would be the best approach for this? To make one Model for times, one for 2023-10-29 and one for the actual keys 0 and 1? Also, since I can't name the variable in my model class 0, how do I tell my application to get this specific value? Can I index it?
10 replies
CC#
Created by .tree on 12/8/2022 in #help
❔ Missing *browse* option in VS2022 Settings.settings
3 replies
CC#
Created by .tree on 12/6/2022 in #help
❔ Method call based on config file
Based on a value in a config file, I want my program to call one of 3 methods who have different parameters but overall do the same thing. What's the best way to handle this? Overloading the method and adding an additional parameter?
10 replies
CC#
Created by .tree on 11/23/2022 in #help
❔ .NET Project in GitHub
I have an existing github repo that I want to add a WPF project to. What's best practice here, clone the repo and create the WPF project inside of it? That way I would have a folder named "myWpfProject" in the "root" git repo. Is that fine? If I want to have folders like "src" as I often see in Github repos, can I just restructure my WPF Project files?
7 replies
CC#
Created by .tree on 11/11/2022 in #help
✅ Consuming REST API in MAUI
I'm pretty new to MAUI and I want to make an app that gets some data from a REST API and presents it, pretty simple. However I am unsure how this works in MAUI. Are there good tutorials or examples?
5 replies