/// <summary> /// Скрыть или отобразить окно с меню /// </summary> /// <param name="sender">Button</param> /// <param name="e">Click</param> private void ShowOrHidePanel(object sender, RoutedEventArgs e) { Button but = (sender as Button); RotateTransform rotate = new RotateTransform(); if (panelMoveProg.IsEnabled) { panelMoveProg.IsEnabled = false; EventHandler @event = (s, es) => { panelMoveProg.IsEnabled = true; }; if (panelMoveProg.Height != 10) { rotate.BeginAnimation(RotateTransform.AngleProperty, StyleUIE.DoubleAnimation(180, TimeSpan.FromSeconds(0.55), 360)); panelMoveProg.BeginAnimation(HeightProperty, StyleUIE.DoubleAnimation(180, TimeSpan.FromSeconds(0.55), 10, @event)); } else { rotate.BeginAnimation(RotateTransform.AngleProperty, StyleUIE.DoubleAnimation(0, TimeSpan.FromSeconds(0.5), 180)); panelMoveProg.BeginAnimation(HeightProperty, StyleUIE.DoubleAnimation(10, TimeSpan.FromSeconds(0.5), 180, @event)); } but.RenderTransform = rotate; } else { panelMoveProg.IsEnabled = true; rotate.BeginAnimation(RotateTransform.AngleProperty, null); panelMoveProg.BeginAnimation(HeightProperty, null); } }
/// <summary> /// Установка информации о проекте /// </summary> /// <param name="thisWindow">Текущее окно</param> /// <param name="nameProject">Имя проекта</param> /// <param name="datePub">Дата публикации</param> /// <param name="rating">Рейтинг</param> /// <param name="countVote">Количество голосов</param> /// <param name="note">Описание</param> /// <param name="hrefImage">Ссылка на картинку</param> /// <param name="viewApp">Категория проекта</param> public static void SetInfoForSettingsPanel(YourProject thisWindow, string nameProject, string datePub, double rating, int countVote, string note, string hrefImage, int viewApp) { #region Анимация панели thisWindow.settingsPanel.BeginAnimation(MarginProperty, StyleUIE.AnimationObject(thisWindow.settingsPanel, TimeSpan.FromSeconds(0.33), new Thickness(0, thisWindow.settingsPanel.Margin.Top, 0, 0))); #endregion string[] exp = nameProject.Split('.'); thisWindow.nameProjTB.Text = nameProject.Replace("." + exp[exp.Length - 1], string.Empty); thisWindow.nameProjTB.Tag = nameProject; thisWindow.nameProjTB.MaxLength = 45 - (exp[exp.Length - 1].Length + 1); thisWindow.expasionText.Text = "." + exp[exp.Length - 1]; thisWindow.dateProjLB.Content = $"Date : {datePub}"; thisWindow.ratingProjLB.Content = $"Rating : {rating}"; thisWindow.countVoteProjLB.Content = $"Count Vote : {countVote}"; if (!hrefImage.Equals(string.Empty) || hrefImage != null) { thisWindow.hrefImageTb.Text = hrefImage; try { thisWindow.imageProj.Fill = new ImageBrush(new BitmapImage(new Uri(hrefImage, UriKind.Absolute))); } catch { } } thisWindow.noteTextBox.Document.Blocks.Clear(); if (!note.Equals(string.Empty) || note != null) { thisWindow.noteTextBox.AppendText(note); } if (viewApp > 0) { thisWindow.comboBoxTypeProj.SelectedIndex = viewApp - 1; } #region Устанавливаем новый рейтинг у проекта double oldRating = (thisWindow.listViewProjects.SelectedItem as MyItemProject).ratingProject; if (rating != oldRating) { int index = thisWindow.listViewProjects.SelectedIndex; StackPanel panelStar = listPanelStars[index]; DrawStarsForProject(panelStar, rating); } #endregion }
/// <summary> /// Появление всплывающего окна /// </summary> /// <param name="sender">Button</param> /// <param name="e">Click</param> private void ShowPopupPanel(object sender, RoutedEventArgs e) { contextButBorder.Visibility = Visibility.Hidden; panelPopup.Visibility = Visibility.Visible; EventHandler handler = (s, es) => { strelkaPopup.Visibility = Visibility.Visible; }; panelPopup.BeginAnimation(MarginProperty, StyleUIE.AnimationObject(panelPopup, TimeSpan.FromSeconds(0.20), new Thickness(this.ActualWidth - (panelPopup.ActualWidth + 5), 10, 0, 0), handler)); }
/// <summary> /// Hide панели с настройками проекта /// </summary> private void SetHiddenSettingsPanel() { #region Анимация панели thisWindow.settingsPanel.BeginAnimation(MarginProperty, StyleUIE.AnimationObject(thisWindow.settingsPanel, TimeSpan.FromSeconds(0.33), new Thickness(0, settingsPanel.Margin.Top, -settingsPanel.ActualWidth - 5, 0), new EventHandler((sen, e) => { settingsPanel.Visibility = Visibility.Hidden; }))); #endregion nameProjTB.IsEnabled = false; comboBoxTypeProj.SelectedIndex = -1; noteTextBox.Document.Blocks.Clear(); }
/// <summary> /// Переход на панель входа\регистрации /// </summary> /// <param name="sender">Button</param> /// <param name="e">Click</param> private void ClickSignBut(object sender, RoutedEventArgs e) { Button sign = (sender as Button); if (sign.Name.Equals("signInBut") && sign.FontSize != 22) { StyleUIE.SetFocusButton(sign, signUpBut); StyleUIE.SwapSignPanel(signInGrid, signUpGrid, signInBut, signUpBut); signIn.IsEnabled = true; signUp.IsEnabled = false; } else if (sign.Name.Equals("signUpBut") && sign.FontSize != 22) { StyleUIE.SetFocusButton(sign, signInBut); StyleUIE.SwapSignPanel(signUpGrid, signInGrid, signInBut, signUpBut); signIn.IsEnabled = false; signUp.IsEnabled = true; } }
/// <summary> /// Отображение панели с кодом потверждения /// </summary> /// <param name="isVisibility">Состояние отображения</param> public void ShowPanelCode(bool isVisibility) { thisWindow.Dispatcher.BeginInvoke(new ThreadStart(() => { if (isVisibility) { panelCode.Visibility = Visibility.Visible; butOk.Visibility = Visibility.Hidden; errorLb.Visibility = Visibility.Hidden; textMsg.Text = textMsg.Text.Replace("###", emailTB.Text.Trim()); SetTimer(); this.BeginAnimation(HeightProperty, StyleUIE.DoubleAnimation(this.ActualHeight, TimeSpan.FromMilliseconds(450), 450)); OperationServer.SendMsgClient(128, 102, mailU); } else { double opacity = 0; DispatcherTimer timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(30) }; errorLb.Visibility = Visibility.Visible; butOk.IsEnabled = false; timer.Tick += (s, e) => { errorLb.Opacity = opacity += 0.05; if (opacity >= 1) { butOk.IsEnabled = true; timer.Stop(); } }; timer.Start(); } })); }