apnxmammoth
apnxmammoth
CC#
Created by Not Garden on 11/2/2024 in #help
The best resources you used to learn C# in the beginning
We actually had the ability to work remotely and all of that, but we got a new office, so we have to go in every day now, but I don't mind to be honest, because I love the work environment we have. It's actually more fun at the office than it is at home.
13 replies
CC#
Created by Not Garden on 11/2/2024 in #help
The best resources you used to learn C# in the beginning
The problem I have with interviews is, and this is me personally, I do not do well under pressure. Neither am I good with theory. So, they would alsways ask theory related questions, but then the explination that I give would not be what they want. I would build a few projects. Add it to your portfolio and when you apply for a job, attach your Github page (this is where you will be uploading your projects), and let them have a look at that. This is good for 2 reasons: 1. They will be able to see what you are capable of. 2. You learn as you go along, and hopefully, if they do give you interview questions, you will be able to answer them easily.
13 replies
CC#
Created by apnxmammoth on 11/2/2024 in #help
.NET MAUI and Android Intents
Alright, since no one was able to help me, I did manage to find the solution myself eventually. So I am just posting it here so that if someone does run into the same issue, hopefully this post will help: Problem: I kept trying to send intents and registering receivers, but my OnReceive method would never trigger in my custom broadcast receiver. Solution: Instead of declaring my intents and my receiver class in the Manifest.xml file, I created a Service.cs and Service class. In there I would have my OnCreate() method, where then I would initialize my component (in this case it was a scanner), and then I would register my receiver.
public override void OnCreate() {
base.OnCreate();
InitializeScanner();
RegisterReceiver();
}

private void RegisterReceiver() {
if (mScannerReceiver == null) {
mScannerReceiver = new ScannerReceiver();
var filter = new IntentFilter(SCAN_ACTION);
RegisterReceiver(mScannerReceiver, filter);
}
}

private void InitializeScanner() {
if (mScanManager == null) {
mScanManager = new ScanManager();
mScanManager.OpenScanner();
}
}
public override void OnCreate() {
base.OnCreate();
InitializeScanner();
RegisterReceiver();
}

private void RegisterReceiver() {
if (mScannerReceiver == null) {
mScannerReceiver = new ScannerReceiver();
var filter = new IntentFilter(SCAN_ACTION);
RegisterReceiver(mScannerReceiver, filter);
}
}

private void InitializeScanner() {
if (mScanManager == null) {
mScanManager = new ScanManager();
mScanManager.OpenScanner();
}
}
Then, in your MainActivity.cs, in your OnCreate(). you would register your service and start your service:
protected override void OnCreate(Bundle? savedInstanceState) {
base.OnCreate(savedInstanceState);

mScannerService = ServiceHelper.GetService<IBarcodeScannerService>();

if (mScannerService == null) {
throw new InvalidOperationException("BarcodeScannerService not found.");
}

var intent = new Intent(this, typeof(BarcodeScannerService));
StartService(intent);
}
protected override void OnCreate(Bundle? savedInstanceState) {
base.OnCreate(savedInstanceState);

mScannerService = ServiceHelper.GetService<IBarcodeScannerService>();

if (mScannerService == null) {
throw new InvalidOperationException("BarcodeScannerService not found.");
}

var intent = new Intent(this, typeof(BarcodeScannerService));
StartService(intent);
}
This finally triggered my OnReceive() method inside my custom broadcast receiver. I know this is probably super easy work for someone that has been working with MAUI for a while, but this was completely new for me.
2 replies
CC#
Created by Not Garden on 11/2/2024 in #help
The best resources you used to learn C# in the beginning
Lol, so, it's kind of funny what happened to me. I studied python, and then I was looking for a job, but the job the guy gave me was for C#. It was a small company (still is), and he threw me in the deep end. I had to develop APIs, build an import tool, integrate with a Wacom signature device, etc. A bit off track, but what I am trying to say is, projects. Do projects and Google. I personally feel like you do not have to buy these online courses or buy the books. Yes, they help, but all of the information is available online. Start by getting some ideas for a little project. Then you move on to the next one, and the next one. Also, Microsoft Docs is an amazing place to go read on the stuff as you are working.
13 replies
CC#
Created by Thang CHO BOC on 11/2/2024 in #help
Web API: structure
Yeah, you can msg there
66 replies
CC#
Created by Thang CHO BOC on 11/2/2024 in #help
Web API: structure
Yeah, just pop me a message or something and then I'll be with you in a bit. Just quickly in a game with a friend
66 replies
CC#
Created by Thang CHO BOC on 11/2/2024 in #help
Web API: structure
Yeah, I can show you some examples and talk you through how I do it if that'll help?
66 replies
CC#
Created by Thang CHO BOC on 11/2/2024 in #help
Web API: structure
I could show the standard structure I follow for all my Web APIs
66 replies