Ejemplo n.º 1
0
 private void Keyboard_Closed(object sender, EventArgs e)
 {
     AyTime.setTimeout(100, () =>
     {
         openPop = false;
     });
 }
Ejemplo n.º 2
0
 private void AyWindow_Loaded(object sender, RoutedEventArgs e)
 {
     LoginWindowType = front;
     AyTime.setTimeout(500, () =>
     {
         windowcontent.Transition = fronttoback;
     });//这个动画是在8秒后完成
 }
Ejemplo n.º 3
0
 internal void SetLoveLock()
 {
     WORLDLOVELOCK = true;
     AyTime.setTimeout(300, () =>
     {
         WORLDLOVELOCK = false;
     });
 }
Ejemplo n.º 4
0
 internal void SetPlayLock()
 {
     WORLDPLAYLOCK = true;
     AyTime.setTimeout(300, () =>
     {
         WORLDPLAYLOCK = false;
     });
 }
Ejemplo n.º 5
0
 private void btnClose_Click(object sender, RoutedEventArgs e)
 {
     windowcontent.Transition = exitWindow;
     LoginWindowType          = null;
     AyTime.setTimeout(500, () =>
     {
         base.DoCloseWindow();
     });
 }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
 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;
         });
     });
 }
Ejemplo n.º 8
0
        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;
                }
            });
        }
Ejemplo n.º 9
0
        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();
        }
Ejemplo n.º 10
0
        //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();
                }
            });
        }
        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;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        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;
        }