mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
using Remotely.Desktop.Win.ViewModels;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media.Animation;
|
|
|
|
namespace Remotely.Desktop.Win
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MainWindow.xaml
|
|
/// </summary>
|
|
public partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public MainWindowViewModel ViewModel => DataContext as MainWindowViewModel;
|
|
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
App.Current.Shutdown();
|
|
}
|
|
|
|
private async void CopyLinkButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ViewModel.CopyLink();
|
|
var tooltip = new ToolTip();
|
|
tooltip.PlacementTarget = sender as Button;
|
|
tooltip.Placement = PlacementMode.Bottom;
|
|
tooltip.VerticalOffset = 5;
|
|
tooltip.Content = "Copied to clipboard!";
|
|
tooltip.HasDropShadow = true;
|
|
tooltip.StaysOpen = false;
|
|
tooltip.IsOpen = true;
|
|
|
|
await Task.Delay(750);
|
|
var animation = new DoubleAnimation(0, TimeSpan.FromMilliseconds(750));
|
|
tooltip.BeginAnimation(OpacityProperty, animation);
|
|
}
|
|
|
|
private void MinimizeButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.WindowState = WindowState.Minimized;
|
|
}
|
|
|
|
private void OptionsButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
(sender as Button).ContextMenu.IsOpen = true;
|
|
}
|
|
|
|
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
await ViewModel.Init();
|
|
}
|
|
|
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
DragMove();
|
|
}
|
|
}
|
|
}
|