Esempio n. 1
0
        private async void CheckUpdatesBtn_Click(object?sender, global::Avalonia.Interactivity.RoutedEventArgs e)
        {
            //check for updates if there is an intenet connection
            if (PV_CheckForInternetConnection() == true)
            {
                if (PV_CheckForUpdates() == true)
                {
                    //show a contentdialog to prompt the user to update
                    ContentDialog UpdateDialog = new ContentDialog();
                    UpdateDialog.Title             = "Update available";
                    UpdateDialog.Content           = "An update is available, would you like to download it?";
                    UpdateDialog.PrimaryButtonText = " Yes ";
                    UpdateDialog.CloseButtonText   = " No ";
                    UpdateDialog.DefaultButton     = ContentDialogButton.Primary;
                    ContentDialogResult result = await UpdateDialog.ShowAsync();

                    if (result == ContentDialogResult.Primary)
                    {
                        //navigate to the update page and shutdown the application
                        PV_OpenBrowser("https://www.github.com/Apollo199999999/LauncherX/releases");

                        this.Close();
                        if (PV_MainWindow != null)
                        {
                            PV_MainWindow.Close();
                        }
                    }
                }
                else if (PV_CheckForUpdates() == false)
                {
                    //show a contentdialog to show that there are no updates available
                    ContentDialog NoUpdateDialog = new ContentDialog();
                    NoUpdateDialog.Title           = "You're up to date!";
                    NoUpdateDialog.Content         = "No updates are available for LauncherX";
                    NoUpdateDialog.CloseButtonText = " OK ";
                    NoUpdateDialog.DefaultButton   = ContentDialogButton.Close;
                    ContentDialogResult result = await NoUpdateDialog.ShowAsync();
                }
            }
            else if (PV_CheckForInternetConnection() == false)
            {
                //no internet conntection available, show an error message
                ContentDialog NoInternetDialog = new ContentDialog();
                NoInternetDialog.Title   = "No internet connection";
                NoInternetDialog.Content = "LauncherX cannot check for updates as there is no internet connection. " +
                                           "Connect to the internet and try again";;
                NoInternetDialog.CloseButtonText = " OK ";
                NoInternetDialog.DefaultButton   = ContentDialogButton.Close;
                ContentDialogResult result = await NoInternetDialog.ShowAsync();
            }
        }
Esempio n. 2
0
        private async void AboutBtn_Click(object?sender, global::Avalonia.Interactivity.RoutedEventArgs e)
        {
            //show a contentdialog with the about page

            //init contentdialog
            ContentDialog AboutDialog = new ContentDialog();

            AboutDialog.Title           = "About LauncherX";
            AboutDialog.CloseButtonText = " OK ";
            AboutDialog.DefaultButton   = ContentDialogButton.Close;
            AboutDialog.Content         = new AboutDialogContentPage();

            var result = await AboutDialog.ShowAsync();
        }
    private void ButtonImport_Click(object sender, global::Avalonia.Interactivity.RoutedEventArgs e)
    {
        string   clipboardText = ClipBoardUtils.GetTextAsync().Result;
        TimeSpan?timeSpan      = DateTimeUtils.ConvertTextToTimeSpan(clipboardText);

        if (timeSpan != null)
        {
            DateTime?newDateTime = _dateTimeConverter.Convert(timeSpan, typeof(string), null, null) as DateTime?;
            Property.PropertyInfo.SetValue(Property.Object, newDateTime);
            _timeTextBox.Text = timeSpan.ToString();
            e.Handled         = true;
        }
        else
        {
            DateTime?dateTime = DateTimeUtils.ConvertTextToDateTime(clipboardText);
            if (dateTime != null)
            {
                Property.PropertyInfo.SetValue(Property.Object, dateTime);
                _datePicker.SelectedDate = dateTime;
                _timeTextBox.Text        = (string)_dateTimeConverter.Convert(dateTime, typeof(string), null, null);
                e.Handled = true;
            }
        }
    }
 private void FileListmakerDialogButton_Click(object sender, global::Avalonia.Interactivity.RoutedEventArgs e)
 {
     /*OpenFileDialog dialog = new OpenFileDialog();
      * dialog.ShowAsync(this);*/
 }
Esempio n. 5
0
    private void Button_Click(object sender, global::Avalonia.Interactivity.RoutedEventArgs e)
    {
        Button button = (Button)sender;

        MethodInfo.Invoke(button.DataContext, new object[] { });
    }
Esempio n. 6
0
 private void LightThmRadioBtn_Checked(object?sender, global::Avalonia.Interactivity.RoutedEventArgs e)
 {
     //set the app theme to light theme
     PV_ChangeApplicationTheme("light");
 }
Esempio n. 7
0
 private void SaveBtn_Click(object?sender, global::Avalonia.Interactivity.RoutedEventArgs e)
 {
     //hide this window after saving settings
     this.Hide();
 }
Esempio n. 8
0
        private void VillagerFilterClear_Click(object?sender, global::Avalonia.Interactivity.RoutedEventArgs e)
        {
            var villagerFilter = this.FindControl <TextBox>("VillagerFilter");

            villagerFilter.Text = string.Empty;
        }
Esempio n. 9
0
 private void ToolbarButton_Click(object sender, global::Avalonia.Interactivity.RoutedEventArgs e)
 {
     Invoke();
 }