-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing default activities for break
- Loading branch information
Showing
7 changed files
with
96 additions
and
19 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,60 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Gtk; | ||
using InteractiveOfficeClient.Models; | ||
|
||
namespace InteractiveOfficeClient | ||
{ | ||
public class ActivityWindow : Gtk.Window | ||
{ | ||
private InteractiveOfficeClient _app; | ||
private readonly Grid _grid = new Grid(); | ||
|
||
public ActivityWindow(InteractiveOfficeClient interactiveOfficeClient) : base("Break Time") | ||
{ | ||
this._app = interactiveOfficeClient; | ||
Add(_grid); | ||
ShowLoading(true); | ||
var activities = Activity.DefaultActivities; | ||
|
||
for (int i = 0; i < activities.Length; i++) | ||
{ | ||
var activity = activities[i]; | ||
|
||
Button b = new ActivityButton(activity); | ||
b.Clicked += delegate { ActivitySelected(activity); }; | ||
|
||
_grid.Attach(b, 0, i, 1, 1); | ||
} | ||
ShowLoading(false); | ||
} | ||
|
||
private void ActivitySelected(Activity activity) | ||
{ | ||
Console.WriteLine($"Selected {activity}"); | ||
_app.State = AppState.Break; | ||
Close(); | ||
} | ||
|
||
private void ShowLoading(bool isLoading) | ||
{ | ||
Console.WriteLine($"IsLoading: {isLoading}"); | ||
} | ||
|
||
} | ||
|
||
class ActivityButton: Gtk.Button | ||
{ | ||
public ActivityButton(Activity a) | ||
{ | ||
if (a.MaximumUsers > 0) | ||
{ | ||
Label = $"{a.Name} ({a.MaximumUsers})"; | ||
} | ||
else | ||
{ | ||
Label = $"{a.Name}"; | ||
} | ||
} | ||
} | ||
} |
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