eduardoA
eduardoA
CC#
Created by eduardoA on 4/25/2024 in #help
Start an app on fullSreem on mac
I did this for Windows
.ConfigureLifecycleEvents(events => {
#if WINDOWS
events.AddWindows(windows => windows
.OnWindowCreated((window) => {

window.ExtendsContentIntoTitleBar = false;
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
switch (appWindow.Presenter) {
case Microsoft.UI.Windowing.OverlappedPresenter overlappedPresenter:
overlappedPresenter.Maximize();
break;
}
}));
#endif
.ConfigureLifecycleEvents(events => {
#if WINDOWS
events.AddWindows(windows => windows
.OnWindowCreated((window) => {

window.ExtendsContentIntoTitleBar = false;
var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
switch (appWindow.Presenter) {
case Microsoft.UI.Windowing.OverlappedPresenter overlappedPresenter:
overlappedPresenter.Maximize();
break;
}
}));
#endif
1 replies
CC#
Created by eduardoA on 4/16/2024 in #help
✅ Transparent flyout items
No description
63 replies
CC#
Created by eduardoA on 4/4/2024 in #help
My shell items are trasparent
No description
7 replies
CC#
Created by eduardoA on 3/25/2024 in #help
✅ how to go fullscreen on MAUI
I am trying to get this to work I need this, for mac, and windows
6 replies
CC#
Created by eduardoA on 3/4/2024 in #help
Login Flow with shell
the fir time I login, everything is fine, but if I do it again I get this
An item with the same key has already been added. Key: 0'
An item with the same key has already been added. Key: 0'
This also happens if I navigate to the same page twice within the app shell
public partial class LoginPageViewModel

[ObservableProperty]
bool isPopOpen;

[ObservableProperty]
User user = new();

[RelayCommand]
void OpenPopUp() {
IsPopOpen = true;
}

[RelayCommand]
async Task Login() {

IsBusy = true;

//var user = await authenticationService.LoginWithEmailAndPassword(User.Email!, User.Password!);
//var user = await authenticationService.LoginWithEmailAndPassword("admin@admin.com", "123456");

await appService.NavigateTo($"{nameof(NewLecturePage)}");
public partial class LoginPageViewModel

[ObservableProperty]
bool isPopOpen;

[ObservableProperty]
User user = new();

[RelayCommand]
void OpenPopUp() {
IsPopOpen = true;
}

[RelayCommand]
async Task Login() {

IsBusy = true;

//var user = await authenticationService.LoginWithEmailAndPassword(User.Email!, User.Password!);
//var user = await authenticationService.LoginWithEmailAndPassword("admin@admin.com", "123456");

await appService.NavigateTo($"{nameof(NewLecturePage)}");
<ShellContent
ContentTemplate="{DataTemplate pages:LoginPage}"
Route="loginPage"
Shell.FlyoutBehavior="Disabled"
Shell.FlyoutItemIsVisible="False" />

<FlyoutItem>
<ShellContent
ContentTemplate="{DataTemplate pages:NewLecturePage}"
Route="NewLecturePage" />
</FlyoutItem>
<ShellContent
ContentTemplate="{DataTemplate pages:LoginPage}"
Route="loginPage"
Shell.FlyoutBehavior="Disabled"
Shell.FlyoutItemIsVisible="False" />

<FlyoutItem>
<ShellContent
ContentTemplate="{DataTemplate pages:NewLecturePage}"
Route="NewLecturePage" />
</FlyoutItem>
public class StartupPageViewModel : BaseViewModel {

private readonly IAppService _appService;
private readonly IConnectivity _connectivity;

public StartupPageViewModel(IAppService appService, IConnectivity connectivity) {

_appService = appService;
_connectivity = connectivity;

CheckInternet(_connectivity.NetworkAccess);

}

private void CheckInternet(NetworkAccess networkAccess) {
if(networkAccess is not NetworkAccess.Internet) {
_appService.NavigateTo($"{nameof(NoInternetPage)}");
} else {
_appService.NavigateTo($"{nameof(LoginPage)}");
}
}
}
public class StartupPageViewModel : BaseViewModel {

private readonly IAppService _appService;
private readonly IConnectivity _connectivity;

public StartupPageViewModel(IAppService appService, IConnectivity connectivity) {

_appService = appService;
_connectivity = connectivity;

CheckInternet(_connectivity.NetworkAccess);

}

private void CheckInternet(NetworkAccess networkAccess) {
if(networkAccess is not NetworkAccess.Internet) {
_appService.NavigateTo($"{nameof(NoInternetPage)}");
} else {
_appService.NavigateTo($"{nameof(LoginPage)}");
}
}
}
1 replies
CC#
Created by eduardoA on 1/27/2024 in #help
JavaScript button - deep linking
No description
2 replies
CC#
Created by eduardoA on 1/17/2024 in #help
Deep Linking Widows
No description
8 replies
CC#
Created by eduardoA on 1/15/2024 in #help
Custom control Binding
No description
2 replies
CC#
Created by eduardoA on 11/29/2023 in #help
Microsoft MVVM toolkit
I have a very simple question I have two entries and a button
<inputLayout:SfTextInputLayout
ContainerBackground="White"
ContainerType="Outlined"
Hint="Email"
IsHintAlwaysFloated="True"
OutlineCornerRadius="8">
<Entry />
</inputLayout:SfTextInputLayout>

<inputLayout:SfTextInputLayout
Grid.Row="1"
ContainerBackground="White"
ContainerType="Outlined"
Hint="Password"
IsHintAlwaysFloated="True"
OutlineCornerRadius="8">
<Entry />
</inputLayout:SfTextInputLayout>

this is the command I am executing
<inputLayout:SfTextInputLayout
ContainerBackground="White"
ContainerType="Outlined"
Hint="Email"
IsHintAlwaysFloated="True"
OutlineCornerRadius="8">
<Entry />
</inputLayout:SfTextInputLayout>

<inputLayout:SfTextInputLayout
Grid.Row="1"
ContainerBackground="White"
ContainerType="Outlined"
Hint="Password"
IsHintAlwaysFloated="True"
OutlineCornerRadius="8">
<Entry />
</inputLayout:SfTextInputLayout>

this is the command I am executing
[RelayCommand] async Task Register() { IsPopOpen = false; //await dataService.AddAsync("Users", Student); } ``` what I want to do is enable the button only if the email and password are entered
9 replies
CC#
Created by eduardoA on 3/8/2023 in #help
❔ Problems stopping the speech
Even though Microsoft tell you to call the stop, dosen't stop the speech I have two buttons: play and stop
<Button
Margin="10,0,0,0"
Command="{Binding SpeakButtonCommand}"
Content="{x:Static res:Lang.Read}"
FocusVisualStyle="{x:Null}"
IsEnabled="{Binding IsPlayingEnabled}" />

<Button
Margin="10,0,0,0"
Command="{Binding StopSpeakButtonCommand}"
Content="{x:Static res:Lang.Stop}"
FocusVisualStyle="{x:Null}"
IsEnabled="{Binding IsStopEnabled}" />
<Button
Margin="10,0,0,0"
Command="{Binding SpeakButtonCommand}"
Content="{x:Static res:Lang.Read}"
FocusVisualStyle="{x:Null}"
IsEnabled="{Binding IsPlayingEnabled}" />

<Button
Margin="10,0,0,0"
Command="{Binding StopSpeakButtonCommand}"
Content="{x:Static res:Lang.Stop}"
FocusVisualStyle="{x:Null}"
IsEnabled="{Binding IsStopEnabled}" />
my VM
IsPlayingEnabled = true;
AzureTextToSpeech = new AzureTextToSpeechService();
IsStopEnabled = false;
sb = new();

Text = GetFile(file);

ColorPairs = ColorHelper.GetColors();
SpeakButtonCommand = new AsyncCommand(SpeakButtonction);
StopSpeakButtonCommand = new AsyncCommand(StopSpeakButtonAction);
}



private async Task StopSpeakButtonAction() {
await AzureTextToSpeech.StopSpeechAsync();
IsPlayingEnabled = true;
IsStopEnabled = false;
}

private async Task SpeakButtonction() {
await AzureTextToSpeech.ReadOutLoudAsync(Text!);
IsPlayingEnabled = false;
IsStopEnabled = true;
}
IsPlayingEnabled = true;
AzureTextToSpeech = new AzureTextToSpeechService();
IsStopEnabled = false;
sb = new();

Text = GetFile(file);

ColorPairs = ColorHelper.GetColors();
SpeakButtonCommand = new AsyncCommand(SpeakButtonction);
StopSpeakButtonCommand = new AsyncCommand(StopSpeakButtonAction);
}



private async Task StopSpeakButtonAction() {
await AzureTextToSpeech.StopSpeechAsync();
IsPlayingEnabled = true;
IsStopEnabled = false;
}

private async Task SpeakButtonction() {
await AzureTextToSpeech.ReadOutLoudAsync(Text!);
IsPlayingEnabled = false;
IsStopEnabled = true;
}
and my service
var config = SpeechConfig.FromSubscription(
ConstantsHelpers.AZURE_SPEECH_KEY,
ConstantsHelpers.AZURE_SPEECH_REGION);

switch (lang.Iso6391Name) {
...//
}



speechSynthesizer = new SpeechSynthesizer(config);
await speechSynthesizer.StartSpeakingTextAsync(text);

}


public async Task StopSpeechAsync() {
await speechSynthesizer.StopSpeakingAsync();
}
var config = SpeechConfig.FromSubscription(
ConstantsHelpers.AZURE_SPEECH_KEY,
ConstantsHelpers.AZURE_SPEECH_REGION);

switch (lang.Iso6391Name) {
...//
}



speechSynthesizer = new SpeechSynthesizer(config);
await speechSynthesizer.StartSpeakingTextAsync(text);

}


public async Task StopSpeechAsync() {
await speechSynthesizer.StopSpeakingAsync();
}
The service reads my text, but when I press stop, it dosent work
2 replies
CC#
Created by eduardoA on 3/6/2023 in #help
Making a shortcut for checking null component in unity
Evetime I create a new component in unity, I something like
if (!TryGetComponent(out _rb2D)) {
Debug.LogError($"There is no rigidbody component in the {transform.name}");
}
if (!TryGetComponent(out _rb2D)) {
Debug.LogError($"There is no rigidbody component in the {transform.name}");
}
So I created a shortcut
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity null check components</Title>
<Shortcut>ucnc</Shortcut>
<Description>This code snippet, will allow you to check you component, to see if they are null</Description>
<Author>Eduardo Gomez</Author>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[
if(!TryGetComponent(out $ComponentName$))
{
Debug.LogError($"There is no $ComponentName$ component in your {transform.name}");
}
]]>
</Code>
<Declarations>
<Literal>
<ID>ComponentName</ID>
<ToolTip>The component name that you want to check for null</ToolTip>
</Literal>
</Declarations>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity null check components</Title>
<Shortcut>ucnc</Shortcut>
<Description>This code snippet, will allow you to check you component, to see if they are null</Description>
<Author>Eduardo Gomez</Author>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[
if(!TryGetComponent(out $ComponentName$))
{
Debug.LogError($"There is no $ComponentName$ component in your {transform.name}");
}
]]>
</Code>
<Declarations>
<Literal>
<ID>ComponentName</ID>
<ToolTip>The component name that you want to check for null</ToolTip>
</Literal>
</Declarations>
</Snippet>
</CodeSnippet>
</CodeSnippets>
but when I use it, I get this
if (!TryGetComponent(out )) {
Debug.LogError(ComponentName
if (!TryGetComponent(out )) {
Debug.LogError(ComponentName
this is not what I want, where is my
Debug.LogError($"There is no $ComponentName$ component in your {transform.name}");
Debug.LogError($"There is no $ComponentName$ component in your {transform.name}");
message? and why there is nothing here
if (!TryGetComponent(out )) {
if (!TryGetComponent(out )) {
for me to edit? and hi it dosent close the if
5 replies
CC#
Created by eduardoA on 3/3/2023 in #help
❔ snippet help
In unity, is always s good practice to null check component. I made this
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity null check components</Title>
<Shortcut>ucnc</Shortcut>
<Description>This code snippet, will allow you to check you component, to see if they are null</Description>
<Author>Eduardo Gomez</Author>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[
if(!TryGetComponent(out $ComponentName$))
{
Debug.LogError($"There is no $ComponentName$ component in your {transform.name}");
}
]]>
</Code>
<Declarations>
<Literal>
<ID>ComponentName</ID>
<ToolTip>The component name that you want to check for null</ToolTip>
</Literal>
</Declarations>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity null check components</Title>
<Shortcut>ucnc</Shortcut>
<Description>This code snippet, will allow you to check you component, to see if they are null</Description>
<Author>Eduardo Gomez</Author>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[
if(!TryGetComponent(out $ComponentName$))
{
Debug.LogError($"There is no $ComponentName$ component in your {transform.name}");
}
]]>
</Code>
<Declarations>
<Literal>
<ID>ComponentName</ID>
<ToolTip>The component name that you want to check for null</ToolTip>
</Literal>
</Declarations>
</Snippet>
</CodeSnippet>
</CodeSnippets>
but when I use it, I get
if (!TryGetComponent(out )) {
Debug.LogError(ComponentName
if (!TryGetComponent(out )) {
Debug.LogError(ComponentName
it dosent close the if. it dosent put all of the debug statement. it dosent put in $Component Nam$ so I can edit it
2 replies
CC#
Created by eduardoA on 3/3/2023 in #help
❔ Azure Speech Service wont shut up
I am using azure in a WPF app, where I have two buttons, Read, and Stop The problem is, that when I click on Stop, it dosent do anything. I already tried to wrap the entire speak process into a thread and cancelling it, and it works 3 times and that it
private async Task StopSpeakButtonAction() {
await AzureTextToSpeech.StopSpeechAsync();
IsPlayingEnabled = true;
IsStopEnabled = false;
}

private async Task SpeakButtonction() {
await AzureTextToSpeech.ReadOutLoudAsync(Text!);
IsPlayingEnabled = false;
IsStopEnabled = true;
}
private async Task StopSpeakButtonAction() {
await AzureTextToSpeech.StopSpeechAsync();
IsPlayingEnabled = true;
IsStopEnabled = false;
}

private async Task SpeakButtonction() {
await AzureTextToSpeech.ReadOutLoudAsync(Text!);
IsPlayingEnabled = false;
IsStopEnabled = true;
}
SpeechSynthesizer speechSynthesizer;

public async Task ReadOutLoudAsync(string text) {


Response<DetectedLanguage> response = textClient.DetectLanguage(text);

DetectedLanguage lang = response.Value;

var config = SpeechConfig.FromSubscription(
ConstantsHelpers.AZURE_SPEECH_KEY,
ConstantsHelpers.AZURE_SPEECH_REGION);


switch (lang.Iso6391Name) {
case "en":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, SaraNeural)";
config.SpeechSynthesisLanguage = "en-us";
break;
case "es":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (es-VE, PaolaNeural)";
config.SpeechSynthesisLanguage = "es-VE";
break;
default:
break;
}



speechSynthesizer = new SpeechSynthesizer(config);
await speechSynthesizer.StartSpeakingTextAsync(text);

}


public async Task StopSpeechAsync() {
await speechSynthesizer.StopSpeakingAsync();
}
SpeechSynthesizer speechSynthesizer;

public async Task ReadOutLoudAsync(string text) {


Response<DetectedLanguage> response = textClient.DetectLanguage(text);

DetectedLanguage lang = response.Value;

var config = SpeechConfig.FromSubscription(
ConstantsHelpers.AZURE_SPEECH_KEY,
ConstantsHelpers.AZURE_SPEECH_REGION);


switch (lang.Iso6391Name) {
case "en":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, SaraNeural)";
config.SpeechSynthesisLanguage = "en-us";
break;
case "es":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (es-VE, PaolaNeural)";
config.SpeechSynthesisLanguage = "es-VE";
break;
default:
break;
}



speechSynthesizer = new SpeechSynthesizer(config);
await speechSynthesizer.StartSpeakingTextAsync(text);

}


public async Task StopSpeechAsync() {
await speechSynthesizer.StopSpeakingAsync();
}
2 replies
CC#
Created by eduardoA on 2/17/2023 in #help
❔ My Azure service do not Stop
I have a text to speech service, and for some reason, when I press the button to stop it dosent do anything
public class AzureTextToSpeechService {

private SpeechSynthesizer? synthesizer;

public async Task ReadOutLoudAsync(string text) {

AzureKeyCredential credentials = new(key);
TextAnalyticsClient textClient = new(endpoint, credentials);

Response<DetectedLanguage> response = textClient.DetectLanguage(text);

DetectedLanguage lang = response.Value;

var config = SpeechConfig.FromSubscription(
ConstantsHelpers.AZURE_SPEECH_KEY,
ConstantsHelpers.AZURE_SPEECH_REGION);

switch (lang.Iso6391Name) {
case "en":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, SaraNeural)";
config.SpeechSynthesisLanguage = "en-us";
break;
case "es":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (es-VE, PaolaNeural)";
config.SpeechSynthesisLanguage = "es-VE";
break;
}

synthesizer = new SpeechSynthesizer(config);
IsSpeaking = true;
await synthesizer.SpeakTextAsync(text);

}

public async Task StopSpeaking() {

if (synthesizer != null && IsSpeaking == true) {
await synthesizer.StopSpeakingAsync();
]
}
}
}
public class AzureTextToSpeechService {

private SpeechSynthesizer? synthesizer;

public async Task ReadOutLoudAsync(string text) {

AzureKeyCredential credentials = new(key);
TextAnalyticsClient textClient = new(endpoint, credentials);

Response<DetectedLanguage> response = textClient.DetectLanguage(text);

DetectedLanguage lang = response.Value;

var config = SpeechConfig.FromSubscription(
ConstantsHelpers.AZURE_SPEECH_KEY,
ConstantsHelpers.AZURE_SPEECH_REGION);

switch (lang.Iso6391Name) {
case "en":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (en-US, SaraNeural)";
config.SpeechSynthesisLanguage = "en-us";
break;
case "es":
config.SpeechSynthesisVoiceName = "Microsoft Server Speech Text to Speech Voice (es-VE, PaolaNeural)";
config.SpeechSynthesisLanguage = "es-VE";
break;
}

synthesizer = new SpeechSynthesizer(config);
IsSpeaking = true;
await synthesizer.SpeakTextAsync(text);

}

public async Task StopSpeaking() {

if (synthesizer != null && IsSpeaking == true) {
await synthesizer.StopSpeakingAsync();
]
}
}
}
I call like this
private void StopSpeakButtonAction() {
AzureTextToSpeechService.StopSpeech();
IsPlayingEnabled = true;
IsStopEnabled = false;
}

private async void SpeakButtonction() {
await AzureTextToSpeechService.ReadOutLoudAsync(Text);
IsPlayingEnabled = false;
IsStopEnabled = true;
}
private void StopSpeakButtonAction() {
AzureTextToSpeechService.StopSpeech();
IsPlayingEnabled = true;
IsStopEnabled = false;
}

private async void SpeakButtonction() {
await AzureTextToSpeechService.ReadOutLoudAsync(Text);
IsPlayingEnabled = false;
IsStopEnabled = true;
}
13 replies