-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added sample files for online DB connection so that anyone can have…
… a look at how the OnlineDataAccessRepository files look like. - Added an ExitApp functionality from MenuBar (Will tinker it a bit more later)
- Loading branch information
Showing
17 changed files
with
191 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
// Use IntelliSense to find out which attributes exist for C# debugging | ||
// Use hover for the description of the existing attributes | ||
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md | ||
"name": ".NET Core Launch (console)", | ||
"type": "coreclr", | ||
"request": "launch", | ||
"preLaunchTask": "build", | ||
// If you have changed target frameworks, make sure to update the program path. | ||
"program": "${workspaceFolder}/FlowHub.Main/bin/Debug/net7.0-windows10.0.19041.0/win10-x64/FlowHub.Main.dll", | ||
"args": [], | ||
"cwd": "${workspaceFolder}/FlowHub.Main", | ||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console | ||
"console": "internalConsole", | ||
"stopAtEntry": false | ||
}, | ||
{ | ||
"name": ".NET Core Attach", | ||
"type": "coreclr", | ||
"request": "attach" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"build", | ||
"${workspaceFolder}/FlowHub-MAUI.sln", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary;ForceNoAlign" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "publish", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"publish", | ||
"${workspaceFolder}/FlowHub-MAUI.sln", | ||
"/property:GenerateFullPaths=true", | ||
"/consoleloggerparameters:NoSummary;ForceNoAlign" | ||
], | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "watch", | ||
"command": "dotnet", | ||
"type": "process", | ||
"args": [ | ||
"watch", | ||
"run", | ||
"--project", | ||
"${workspaceFolder}/FlowHub-MAUI.sln" | ||
], | ||
"problemMatcher": "$msCompile" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
FlowHub.DataAccess/Platforms/Android/OnlineDataAccessRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace FlowHub.DataAccess; | ||
|
||
public class OnlineDataAccessRepository : IOnlineCredentialsRepository | ||
{ | ||
public IMongoDatabase OnlineMongoDatabase { get; set; } | ||
public void GetOnlineConnection() | ||
{ | ||
if (Connectivity.Current.NetworkAccess.Equals(NetworkAccess.Internet)) | ||
{ | ||
IMongoDatabase db = new MongoClient("<< YOUR ATLAS CONNECTION STRING >>") | ||
.GetDatabase("<<YOUR DB NAME>>"); | ||
OnlineMongoDatabase = db; | ||
} | ||
else | ||
{ | ||
_ = Shell.Current.DisplayAlert("No Internet Found!", "Please Connect your devcice to the internet", "OK"); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
FlowHub.DataAccess/Platforms/Windows/OnlineDataAccessRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace FlowHub.DataAccess; | ||
|
||
public class OnlineDataAccessRepository : IOnlineCredentialsRepository | ||
{ | ||
public IMongoDatabase OnlineMongoDatabase { get; set; } | ||
public void GetOnlineConnection() | ||
{ | ||
if (Connectivity.Current.NetworkAccess.Equals(NetworkAccess.Internet)) | ||
{ | ||
IMongoDatabase db = new MongoClient("<< YOUR ATLAS CONNECTION STRING " + | ||
"YOU CAN FIND IT IN YOUR MONGODB ATLAS" + | ||
"GO TO YOUR DATABSE UNDER DEPLOYMENT" + | ||
"YOU'LL SEE YOUR CLUSTER (OR CREATE ONE IF INEXISTANT)" + | ||
"ON YOUR CLUSTER THERE WILL BE A CONNECT BUTTON, CLICK ON IT AND CLICK DRIVERS" + | ||
"FOR WINDOWS, USE DRIVER : C#/.NET AND VERSION 2.13 or Later!!!!>>") | ||
.GetDatabase("<<YOUR DB NAME>>"); | ||
OnlineMongoDatabase = db; | ||
} | ||
else | ||
{ | ||
_ = Shell.Current.DisplayAlert("No Internet Found!", "Please Connect your devcice to the internet", "OK"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="FlowHub.Main.Views.Desktop.ExitApp" | ||
Title="ExitApp"> | ||
<VerticalStackLayout> | ||
<Label | ||
Text="Welcome to .NET MAUI!" | ||
VerticalOptions="Center" | ||
HorizontalOptions="Center" /> | ||
</VerticalStackLayout> | ||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace FlowHub.Main.Views.Desktop; | ||
|
||
public partial class ExitApp : ContentPage | ||
{ | ||
public ExitApp() | ||
{ | ||
InitializeComponent(); | ||
} | ||
protected override void OnAppearing() | ||
{ | ||
base.OnAppearing(); | ||
|
||
OnExitAppearing(); | ||
} | ||
|
||
async void OnExitAppearing() | ||
{ | ||
bool result = await DisplayAlert("Confirm Exit", "Do You Want To Exit Application?", "Yes", "No"); | ||
//bool result = (bool)await Shell.Current.ShowPopupAsync(new AcceptCancelPopUpAlert("ss")); | ||
if (result) | ||
{ | ||
Environment.Exit(0); | ||
} | ||
else | ||
{ | ||
await Shell.Current.GoToAsync($"//{nameof(HomePageD)}", true); | ||
Debug.WriteLine("Cancelled Exit"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters