private async void DispatchButton_Click(object sender, RoutedEventArgs e) { Random Random = new Random(); int HashCode = Random.Next(100000, 999999); string Type = "Использование читов"; DoubleAnimation OpacityAnimation = new DoubleAnimation(); OpacityAnimation.From = Dispatch.Opacity; OpacityAnimation.To = 0; OpacityAnimation.Duration = TimeSpan.FromSeconds(0.3); Dispatch.BeginAnimation(Border.OpacityProperty, OpacityAnimation); Dispatch.IsEnabled = false; await Task.Delay(400); if (ViolationComboBox.SelectedIndex == 0) { Type = "Использование читов"; } else if (ViolationComboBox.SelectedIndex == 1) { Type = "Использование багов"; } else if (ViolationComboBox.SelectedIndex == 2) { Type = "Токсичное поведение"; } else if (ViolationComboBox.SelectedIndex == 3) { Type = "Недоработка проекта"; } try { using (FileStream FileStream = File.Create(TotalPath + @"/Storage/Saves/report")) { byte[] Text = new UTF8Encoding(true).GetBytes("Дата: " + DateTime.Now.ToString() + "\n" + "Никнейм: " + NicknameTextBox.Text + "\n" + "Вид нарушения: " + Type + "\n" + "Сообщение: " + ViolationTextBox.Text); FileStream.Write(Text, 0, Text.Length); } using (SftpClient Client = new SftpClient("bedrock-project.ru", "root", "singularity")) { Client.Connect(); using (var UploadFile = File.OpenRead(TotalPath + @"/Storage/Saves/report")) { Client.UploadFile(UploadFile, "/storage/reports/report" + HashCode); } Client.Disconnect(); } } catch { } DoubleAnimation WindowOpacityAnimation = new DoubleAnimation(); WindowOpacityAnimation.From = this.Opacity; WindowOpacityAnimation.To = 0; WindowOpacityAnimation.Duration = TimeSpan.FromSeconds(0.3); this.BeginAnimation(Window.OpacityProperty, WindowOpacityAnimation); await Task.Delay(300); this.Owner.Effect = null; this.Close(); }