private void Keyboard_Closed(object sender, EventArgs e) { AyTime.setTimeout(100, () => { openPop = false; }); }
private void AyWindow_Loaded(object sender, RoutedEventArgs e) { LoginWindowType = front; AyTime.setTimeout(500, () => { windowcontent.Transition = fronttoback; });//这个动画是在8秒后完成 }
internal void SetPlayLock() { WORLDPLAYLOCK = true; AyTime.setTimeout(300, () => { WORLDPLAYLOCK = false; }); }
internal void SetLoveLock() { WORLDLOVELOCK = true; AyTime.setTimeout(300, () => { WORLDLOVELOCK = false; }); }
private void btnClose_Click(object sender, RoutedEventArgs e) { windowcontent.Transition = exitWindow; LoginWindowType = null; AyTime.setTimeout(500, () => { base.DoCloseWindow(); }); }
private void btn_readFileData_Click(object sender, RoutedEventArgs e) { AyTime.setTimeout(1, () => { btn_exit.IsEnabled = false; btn_inputDataToDatabase.IsEnabled = false; btn_readFileData.IsEnabled = false; btn_selectFile.IsEnabled = false; ReadExcelData(filePath); btn_exit.IsEnabled = true; }); GC.Collect(); }
private void AyAnimationButton_Click(object sender, RoutedEventArgs e) { //AyMessageBox.ShowInformation("开始软件分析了!"); startAnalysis.Visibility = Visibility.Collapsed; startAnalysissing.Visibility = Visibility.Visible; AyThread.Instance.InitDispatcher(this.Dispatcher); AyTime.setTimeout(5000, () => { AyThread.Instance.RunUI(() => { startAnalysis.Visibility = Visibility.Visible; startAnalysissing.Visibility = Visibility.Collapsed; }); }); }
private void SkinGetterXuanChuan_Loaded(object sender, RoutedEventArgs e) { //double _1 = 0; for (int i = 0; i < Number; i++) { RadioButton rb = new RadioButton(); rb.AddHandler(UIElement.MouseEnterEvent, new MouseEventHandler(Rb_MouseEnter), true); rb.AddHandler(UIElement.MouseLeaveEvent, new MouseEventHandler(Rb_MouseLeave), true); rb.Checked += Rb_Checked; rb.SetResourceReference(RadioButton.StyleProperty, "rdoNavSkin"); if (i == 0) { rb.IsChecked = true; } if (i > 0) { rb.Margin = new Thickness(12, 0, 0, 0); } rb.Tag = i; //_1 = _1 + LeftWidth; sp_navs.Children.Add(rb); } ad = new AyAniDouble(prev); isfirst = true; autoPlay = AyTime.setInterval(1000, () => { if (currplayIndex == (Number - 1)) { //最后1个 currplayIndex = 0; var _1 = sp_navs.Children[currplayIndex.ToInt()]; var _2 = _1 as RadioButton; _2.IsChecked = true; } else { currplayIndex++; var _1 = sp_navs.Children[currplayIndex.ToInt()]; var _2 = _1 as RadioButton; _2.IsChecked = true; } }); }
private void btnUseTen10_Click(object sender, RoutedEventArgs e) { md_zuanxiaofei.Message = "赠送星光水晶中,请稍后"; md_zuanxiaofei.Visibility = Visibility.Visible; var _122 = AyCommon.Rnd.Next(1, 300); AyTime.setTimeout(_122, () => { md_zuanxiaofei.Visibility = Visibility.Collapsed; //检查钻石 bool hasZuan = true; //开始抽奖 if (hasZuan) { sgc.JiangPin = CreateGiftResult(); //TODO同步数据到本地 //展示 sgc.TitleBar = "璀璨星光水晶"; sgc.Visibility = Visibility.Visible; } }); }
private async void ReadExcelData(String @path) { if (StringUtil.isBlank(@path)) { AyMessageBox.ShowError("文件路径不正确!"); btn_readFileData.IsEnabled = true; btn_selectFile.IsEnabled = true; return; } try { fileStream = new FileStream(@path, FileMode.Open, FileAccess.Read); } catch (Exception ex) { AyMessageBox.ShowError(ex.ToString()); btn_readFileData.IsEnabled = true; btn_selectFile.IsEnabled = true; return; } if (fileStream.CanRead) { String houzhui = fileStream.Name.Substring(fileStream.Name.LastIndexOf(".") + 1, fileStream.Name.Length - fileStream.Name.LastIndexOf(".") - 1); if ("xls".Equals(houzhui)) { workbook = new HSSFWorkbook(fileStream); } else if ("xlsx".Equals(houzhui)) { workbook = new XSSFWorkbook(fileStream); } } else { AyMessageBox.ShowError("文件读取失败!"); workbook = null; return; } sheet = workbook.GetSheetAt(0); if (sheet == null) { return; } table_datagrid.Columns.Clear(); DataGridTemplateColumn index_col_val = TransExpV2 <DataGridTemplateColumn, DataGridTemplateColumn> .Trans(index_col); DataGridTemplateColumn input_state_col_val = TransExpV2 <DataGridTemplateColumn, DataGridTemplateColumn> .Trans(input_state_col); index_col_val.DisplayIndex = 0; table_datagrid.Columns.Add(index_col_val); //获取总行数 rowCount = sheet.PhysicalNumberOfRows; int i, j; if (rowCount > 0) { //根据第一行,获取总列数 titleRow = sheet.GetRow(0); colCount = titleRow.PhysicalNumberOfCells; //初始化字段名称和表格标题名称的数组大小 fieldArray = new String[colCount]; headerArray = new String[colCount]; for (i = 0; i < colCount; i++) { String titleString = titleRow.GetCell(i).StringCellValue; if (StringUtil.isNotBlank(titleString)) { String[] titleStringSplitArr = titleString.Replace(" ", "").Split(new Char[] { '(', ')', ',', ':', '[', ']', '(', ')', ',', ':', '【', '】' }, StringSplitOptions.RemoveEmptyEntries); if (titleStringSplitArr != null) { if (titleStringSplitArr.Count() == 3) { headerArray[i] = titleStringSplitArr[1]; fieldArray[i] = titleStringSplitArr[2]; if ("*".Equals(titleStringSplitArr[0])) { AddColumn(headerArray[i], "*", i + 1); } else { AddColumn(headerArray[i], titleStringSplitArr[0], i + 1); } } else if (titleStringSplitArr.Count() == 2) { headerArray[i] = titleStringSplitArr[0]; fieldArray[i] = titleStringSplitArr[1]; AddColumn(headerArray[i], "200", i + 1); } else if (titleStringSplitArr.Count() == 1) { fieldArray[i] = titleStringSplitArr[0]; AddColumn(fieldArray[i], "200", i + 1); } else { AyMessageBox.ShowError("标题和字段信息初始化错误!"); } } } } } //填充数据 AyTime.setTimeout(1, () => { try { btn_inputDataToDatabase.IsEnabled = false; cb_empty.IsEnabled = false; cb_re.IsEnabled = false; cmb_fielditem.IsEnabled = false; cmb_fielditem.SelectedIndex = -1; cmb_fielditem.Text = ""; cmb_fielditem.Items.Clear(); list.Clear(); for (i = 1; i < rowCount; i++) { RowViewItem rowItem = new RowViewItem(); rowItem._number = i.ToString(); IRow rowData = sheet.GetRow(i); for (j = 0; j < colCount; j++) { String value = rowData.GetCell(j).ToString(); SetValue(ref rowItem, j + 1, value); } rowItem._state = "尚未导入"; list.Add(rowItem); } } catch (Exception ex) { btn_inputDataToDatabase.IsEnabled = false; cb_empty.IsEnabled = false; cb_re.IsEnabled = false; cmb_fielditem.IsEnabled = false; cmb_fielditem.SelectedIndex = -1; cmb_fielditem.Text = ""; cmb_fielditem.Items.Clear(); AyMessageBox.ShowError("数据填充时发生错误:" + ex.ToString()); } finally { if (!readTableNames) { if (list.Count > 0) { if (cmb_tables.IsEnabled) { btn_inputDataToDatabase.IsEnabled = true; } } } btn_selectFile.IsEnabled = true; btn_readFileData.IsEnabled = true; } cb_empty.IsEnabled = true; cb_re.IsEnabled = true; cmb_fielditem.IsEnabled = true; int f_count = fieldArray.Count(); int h_count = headerArray.Count(); cmb_fielditem.Items.Add(new ComboBoxItem()); for (i = 0; i < f_count && i < h_count; i++) { ComboBoxItem cbi = new ComboBoxItem(); cbi.Content = headerArray[i]; cbi.Uid = fieldArray[i]; cmb_fielditem.Items.Add(cbi); } }); input_state_col_val.DisplayIndex = table_datagrid.Columns.Count(); table_datagrid.Columns.Add(input_state_col_val); reFlag = false; emptyFlag = false; cb_re.IsChecked = false; cb_empty.IsChecked = false; cmb_fielditem.SelectedIndex = -1; cmb_fielditem.Text = ""; //添加行数据 //table_datagrid. GC.Collect(); }
//IEasingFunction d2 = new System.Windows.Media.Animation.CircleEase { EasingMode = EasingMode.EaseOut }; public void AnimateShowCard() { List <AyAniDouble> anis = new List <AyAniDouble>(); //ug.Children; foreach (var item in ug.Children) { AyAniDouble ad = new AyAniDouble(item as SkinGetterViewBox2); ad.FromDouble = 0; ad.ToDouble = 1; ad.AniPropertyPath = pp; ad.AnimateSpeed = 200; ad.AniEasingMode = 1; anis.Add(ad); } if (ug.Children.Count > 0) { anis[0].Animate().End(); } int diz = 500; int first = 500; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[1].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[2].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[3].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[4].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[5].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[6].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[7].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[8].Animate().End(); } }); first = first + diz; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { anis[9].Animate().End(); } }); first = first + diz; var bn = new AyAniSlideInLeft(ugEx, () => { }); bn.FromDistance = -192; bn.OpacityNeed = false; bn.AnimateSpeed = 200; AyTime.setTimeout(first, () => { if (ug.Children.Count > 0) { bn.Animate().End(); } }); }
internal static void PlayAyMusic(PlayListItemModel music) { if (System.IO.File.Exists(music.SongPath)) { if (currentPlayTimer != null) { currentPlayTimer.Stop(); currentPlayTimer = null; } MainWindow.curr.ProgressEnbaled = true; if (lastMusic != null) { MainWindow.CurrentPlayer.Stop(); MainWindow.CurrentPlayer.Dispose(); } if (music.ExtName == ".mp3") { Mp3File mp3 = new Mp3File(music.SongPath); if (mp3.TagHandler.Picture != null) { MemoryStream stream = new MemoryStream(AyFuncFactory.GetFunc <AyFuncBitmapWithWpf>().ImageToBytes(mp3.TagHandler.Picture, System.Drawing.Imaging.ImageFormat.Jpeg)); string filename = AyFuncFactory.GetFunc <AyFuncSecrity>().GetMD5Result(mp3.TagHandler.Song + mp3.TagHandler.Artist.ToObjectString()); filename = ExtendUtils.GetDATA_TEMP_ALBUM_PATH() + "\\" + filename + ".jpg"; var dsd = imageSourceConverter.ConvertFrom(stream); if (!File.Exists(filename)) { System.Drawing.Image bm = System.Drawing.Image.FromStream(stream, true); bm.Save(filename); } if (dsd == null) { MainWindow.SetAlbumImage(null, filename); } else { MainWindow.SetAlbumImage(dsd as System.Windows.Media.Imaging.BitmapFrame, filename); } } else { MainWindow.SetAlbumImage(null); } MainWindow.curr.Singer = "- " + mp3.TagHandler.Artist; mp3 = null; AyExtension.MemoryGC(); } else { MainWindow.curr.Singer = "- 未知AY"; } MainWindow.CurrentPlayer = new VlcPlayer(); MainWindow.CurrentPlayer.Initialize(@"Contents\LibVlc", new string[] { "-I", "--dummy", "--ignore-config", "--no-video-title", "--no-sub-autodetect-file" }); MainWindow.CurrentPlayer.EndBehavior = EndBehavior.Repeat; MainWindow.CurrentPlayer.LoadMedia(music.SongPath); MainWindow.CurrentPlayer.Play(); MainWindow.CurSongGuid = music.SongGuid; music.PlayStatus = true; MainWindow.curr.WorldPlayStatus = true; MainWindow.curr.GeName = music.SongNameWithoutExt; if (lastMusic != null && lastMusic.SongGuid != music.SongGuid) { lastMusic.PlayStatus = false; } lastMusic = music; MainWindow.curr.WorldLoveStatus = music.LoveStatus; currentPlayTimer = AyTime.setInterval(100, () => { var totalDuration = MainWindow.CurrentPlayer.GetDuration(); if (totalDuration.Hours > 0) { MainWindow.curr.TotalTime = string.Format("{0:00}:{1:00}:{2:00}", totalDuration.Hours, totalDuration.Minutes, totalDuration.Seconds); } else if (totalDuration.Hours == 0) { MainWindow.curr.TotalTime = string.Format("{0:00}:{1:00}", totalDuration.Minutes, totalDuration.Seconds); } if (MainWindow.CurrentPlayer != null && (MainWindow.CurrentPlayer.State == Meta.Vlc.Interop.Media.MediaState.Paused || MainWindow.CurrentPlayer.State == Meta.Vlc.Interop.Media.MediaState.Stopped)) { currentPlayTimer.Stop(); } var dd = MainWindow.CurrentPlayer.GetPlayTime(); MainWindow.curr.CurrentTime = string.Format("{0:00}:{1:00}:{2:00}", dd.Hours, dd.Minutes, dd.Seconds); if (dd.Hours > 0) { MainWindow.curr.CurrentTime = string.Format("{0:00}:{1:00}:{2:00}", dd.Hours, dd.Minutes, dd.Seconds); } else if (dd.Hours == 0) { MainWindow.curr.CurrentTime = string.Format("{0:00}:{1:00}", dd.Minutes, dd.Seconds); } if (!MainWindow.curr.sliderProgressLock) { MainWindow.curr.CurrentPlayerPosition = MainWindow.CurrentPlayer.Position; } }); } else { AyMessageBox.ShowInformation("音乐文件不存在!"); } }
protected override void Invoke(object parameter) { var d = new System.Windows.Forms.FolderBrowserDialog(); if (DefaultPath.IsNotNull()) { d.SelectedPath = AyFuncIO.Instance.GetDirectory(DefaultPath); } d.ShowNewFolderButton = true; d.Description = Description; if (d.ShowDialog() == Winform.DialogResult.OK) { string dirPath = d.SelectedPath; string diskNumber = dirPath[0].ToString(); double canUsage = AyFuncDisk.Instance.GetHardDiskFreeSpace1(diskNumber); //单位B double totalUsage = AyFuncDisk.Instance.GetHardDiskSpace1(diskNumber); //单位B if (MinSpaceUsage.HasValue && MinSpaceUsage.Value > canUsage) { apErrorToolTip.IsOpen = true; _tb.Text = "磁盘可用空间不足,至少需要" + AyFuncDisk.Instance.GetFileOrDirectoryFormatedSize(MinSpaceUsage.Value) + "可用空间"; AyTime.setTimeout(3000, () => { apErrorToolTip.IsOpen = false; }); return; } SelectTotalFolderCapacity = totalUsage; SelectFolderCapacity = canUsage; var _1 = TotalSizeStringFormat.StringFormat(AyFuncDisk.Instance.GetFileOrDirectoryFormatedSize(totalUsage)); var _2 = SizeStringFormat.StringFormat(AyFuncDisk.Instance.GetFileOrDirectoryFormatedSize(canUsage)); if (SizeTarget.IsNotNull()) { var _11 = SizeTarget as TextBox; if (_11 != null) { _11.Text = _2; } else { var _12 = SizeTarget as TextBlock; if (_12.IsNotNull()) { _12.Text = _2; } else { var _13 = SizeTarget as Label; if (_13.IsNotNull()) { _13.Content = _2; } } } } if (TotalSizeTarget.IsNotNull()) { var _11 = TotalSizeTarget as TextBox; if (_11 != null) { _11.Text = _1; } else { var _12 = TotalSizeTarget as TextBlock; if (_12.IsNotNull()) { _12.Text = _1; } else { var _13 = TotalSizeTarget as Label; if (_13.IsNotNull()) { _13.Content = _1; } } } } if (Selected != null) { Selected(dirPath, new RoutedEventArgs() { }); } if (SelectedCommand != null) { SelectedCommand.Execute(dirPath); } if (Target.IsNotNull()) { var _11 = Target as TextBox; if (_11 != null) { _11.Text = dirPath; } else { var _12 = Target as TextBlock; if (_12.IsNotNull()) { _12.Text = dirPath; } else { var _13 = Target as Label; if (_13.IsNotNull()) { _13.Content = dirPath; } } } } } }
public static void Start(Action func) { isContinue = true; timer = AyTime.setInterval(10, func); }
protected override void Invoke(object parameter) { if (MaxFileCount > 0 && CurrentFileCount >= MaxFileCount) { apErrorToolTip.IsOpen = true; _tb.Text = "最多只能选择" + MaxFileCount + "个文件"; AyTime.setTimeout(3000, () => { apErrorToolTip.IsOpen = false; }); return; } var d = new System.Windows.Forms.OpenFileDialog(); if (DefaultFolderPath.IsNotNull()) { d.InitialDirectory = DefaultFolderPath; } d.Multiselect = IsMultiply; if (FileExtensionMappers.ContainsKey(FileExtension)) { d.Filter = FileExtensionMappers[FileExtension]; } else { d.Filter = FileExtension; } if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (IsMultiply == false) { string filePath = d.FileName; FileInfo fi = new FileInfo(filePath); if (MaxFileLength > 0 && fi.Length > MaxFileLength) { MessageBox.Show("你选择的文件过大,目前仅支持小于" + GetSize(MaxFileLength) + "的文件", "文件选择错误"); return; } if (Selected != null) { Selected(filePath, new RoutedEventArgs() { }); } if (SelectedCommand != null) { SelectedCommand.Execute(filePath); } if (Target.IsNotNull()) { var _11 = Target as TextBox; if (_11 != null) { _11.Text = System.IO.Path.GetFileName(filePath); } else { var _12 = Target as TextBlock; if (_12.IsNotNull()) { _12.Text = System.IO.Path.GetFileName(filePath); } else { var _13 = Target as Label; if (_13.IsNotNull()) { _13.Content = System.IO.Path.GetFileName(filePath); } } } } } else { string[] filePaths = d.FileNames; bool hasNo = false; if (MaxFileLength > 0) { foreach (var filePath in filePaths) { FileInfo fi = new FileInfo(filePath); if (fi.Length > MaxFileLength) { MessageBox.Show("你选择的文件中有文件过大,目前仅支持小于" + GetSize(MaxFileLength) + "的文件。\r\n" + fi.Name + "(" + GetSize(fi.Length) + ")", "文件选择错误"); hasNo = true; break; } } } if (hasNo) { return; } if (Selected != null) { Selected(filePaths, new RoutedEventArgs() { }); } if (SelectedCommand != null) { SelectedCommand.Execute(filePaths); } if (Target.IsNotNull()) { var _11 = Target as TextBox; if (_11 != null) { _11.Text = GetFIleNameList(filePaths); } else { var _12 = Target as TextBlock; if (_12.IsNotNull()) { _12.Text = GetFIleNameList(filePaths); } else { var _13 = Target as Label; if (_13.IsNotNull()) { _13.Content = GetFIleNameList(filePaths); } } } } } } //arl.FileLength = fi.Length; //arl.FilePath = filePath; //arl.FileName = System.IO.Path.GetFileName(filePath); //arl.Duration = AyExtension.GetGuidNoSplit; }