예제 #1
0
        private void ErrorMSG(String ex, String say)
        {
            this.Dispatcher.BeginInvoke(new Action(() =>
            {
                SSMessageHelper.noNo = false;
                ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                SSMessageHelper.Title      = "更新失败";
                SSMessageHelper.bNOtext    = "不用不用";
                SSMessageHelper.bOKtext    = "打开日志";
                SSMessageHelper.Says       = "在更新时发生了错误,更新失败。" + say + "\n" + ex;
                SSMessageBox MB            = new SSMessageBox();
                ParentWindow.IsMaskVisible = true;
                MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                MB.Owner = ParentWindow;
                MB.ShowDialog();
                ParentWindow.IsMaskVisible = false;

                if (SSMessageHelper.buttonOK)
                {
                    string where = Directory.GetCurrentDirectory();
                    where        = where + @"\SSTB\Log\log.log";
                    System.Diagnostics.Process process;
                    process = System.Diagnostics.Process.Start(@where);
                }
                ForceClose();
            }), DispatcherPriority.SystemIdle, null);
        }
예제 #2
0
파일: Page7.xaml.cs 프로젝트: op07n/test23
        void CD_Del(object sender, MouseButtonEventArgs e)
        {
            SSMessageHelper.noNo = false;
            ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
            SSMessageHelper.Title = "确认一下";
            SSMessageHelper.Says  = "确认要删除卡片嘛,它和它里面的事件们将消失很久!(真的很久很久……)";
            SSMessageBox MB = new SSMessageBox();

            ParentWindow.IsMaskVisible = true;
            MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
            MB.Owner = ParentWindow;
            MB.ShowDialog();
            ParentWindow.IsMaskVisible = false;
            if (SSMessageHelper.buttonOK)
            {
                DeleteItem(1, new ControlItemInfo {
                    IsDelInFile = true, IsFinish = false
                });
            }
        }
예제 #3
0
파일: Page7.xaml.cs 프로젝트: op07n/test23
        private void DelCard_Click(object sender, RoutedEventArgs e)
        {
            Button button   = (Button)sender;
            string cardname = button.Name.Substring(1);

            card = (Card)FindName(cardname);
            SSMessageHelper.noNo = false;
            ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
            SSMessageHelper.Title = "确认一下";
            SSMessageHelper.Says  = "确认要删除卡片嘛,它和它里面的事件们将消失很久!(真的很久很久……)";
            SSMessageBox MB = new SSMessageBox();

            ParentWindow.IsMaskVisible = true;
            MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
            MB.Owner = ParentWindow;
            MB.ShowDialog();
            ParentWindow.IsMaskVisible = false;
            if (SSMessageHelper.buttonOK)
            {
                DeleteItem(1, new ControlItemInfo {
                    IsDelInFile = true, IsFinish = false
                });
            }
        }
예제 #4
0
파일: Page7.xaml.cs 프로젝트: op07n/test23
        /// <summary>
        /// RunButton_Click_1
        /// RunButton按下事件,刷新列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunButton_Click_1(object sender, RoutedEventArgs e)
        {
            //判断私隐密码
            if (Main.Settings["Features"]["Privacy"]["Password"].ToString() != "NULL")
            {
                PassWordEnterF7 EP = new PassWordEnterF7();
                ParentWindow.IsMaskVisible = true;
                EP.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                EP.Owner = ParentWindow;
                EP.ShowDialog();
                ParentWindow.IsMaskVisible = false;
            }
            else
            {
                LoadingSetter.PasswordPass = true;
            }
            if (!LoadingSetter.PasswordPass)
            {
                return;
            }
            LoadingSetter.PasswordPass = false;
            if (!err)
            {
                //判断存档版本
                if (Notes["Stat"]["Version"].ToString() != FileVersion.ToString())
                {
                    SSMessageHelper.noNo = true;
                    ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                    SSMessageHelper.Title = "存档版本不符";
                    SSMessageHelper.Says  = "我们将取消读取档案,请至 File/Setups 文件夹下备份 NoteSaves.json 文件并删除以继续使用。\n(为什么要你手动删除而不自动?因为我想确保你确实去备份了,并且顺便删了。)";
                    SSMessageBox MB = new SSMessageBox();
                    ParentWindow.IsMaskVisible = true;
                    MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                    MB.Owner = ParentWindow;
                    MB.ShowDialog();
                    ParentWindow.IsMaskVisible = false;

                    this.RunCard.Visibility = Visibility.Visible;
                    error.ErrorTo("存档版本不符。", Percent, Errorsay);
                    error.logWriter("Tool7:存档版本不符。", false);
                    err = true;
                    return;
                }
            }

            int[] things = new int[3];
            try
            {
                if (!err && int.Parse(Notes["Stat"]["NumOfDef"].ToString()) != 0)
                {
                    for (int i = 1; i <= int.Parse(Notes["Stat"]["NumOfDef"].ToString()); i++)
                    {
                        if (int.Parse(Notes["Cards"]["Def"][i.ToString()]["Stat"].ToString()) != 0)
                        {
                            for (int j = 1; j <= int.Parse(Notes["Cards"]["Def"][i.ToString()]["Stat"].ToString()); j++)
                            {
                                things[0] = j;
                                things[1] = i;
                                if (bool.Parse(Notes["Cards"]["Def"][i.ToString()][j.ToString()]["CantDel"].ToString()))
                                {
                                    things[2] = 1;
                                }
                                else
                                {
                                    things[2] = 0;
                                }
                                AddColtrols(2, things, Notes["Cards"]["Def"][i.ToString()][j.ToString()]["Title"].ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SSMessageHelper.noNo = false;
                ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                SSMessageHelper.Title   = "读取JSON错误";
                SSMessageHelper.bNOtext = "不用不用";
                SSMessageHelper.bOKtext = "打开日志";
                SSMessageHelper.Says    = "我们发现了一个崩溃性的错误,是否反馈它,如果不反馈,这个错误将永远得不到修复!\n" + ex;
                SSMessageBox MB = new SSMessageBox();
                ParentWindow.IsMaskVisible = true;
                MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                MB.Owner = ParentWindow;
                MB.ShowDialog();
                ParentWindow.IsMaskVisible = false;

                error.logWriter("Tool7:读取JSON错误。" + ex, false);
                if (SSMessageHelper.buttonOK)
                {
                    string where = Directory.GetCurrentDirectory();
                    where        = where + @"\SSTB\Log\log.log";
                    Process process;
                    process = System.Diagnostics.Process.Start(@where);
                }
                Application.Current.Shutdown();
            }
            this.CD1.Visibility  = Visibility.Visible;
            this.LOAD.Visibility = Visibility.Collapsed;
            this.MT1.Visibility  = Visibility.Collapsed;
        }
예제 #5
0
파일: Page7.xaml.cs 프로젝트: op07n/test23
        private void AddWhat_DropDownClosed(object sender, EventArgs e)
        {
            AddWhereList = new List <listMain>();
            AddWhereList.Add(new listMain()
            {
                ID = 0, Name = "  < 空 >"
            });

            if (int.Parse(AddWhat.SelectedValue.ToString()) != 1 && int.Parse(AddWhat.SelectedValue.ToString()) != 0)
            {
                this.HID.Visibility = Visibility.Visible;
            }
            else
            {
                this.HID.Visibility = Visibility.Collapsed;
            }
            try
            {
                if (int.Parse(AddWhat.SelectedValue.ToString()) != 1 && int.Parse(AddWhat.SelectedValue.ToString()) != 0)
                {
                    for (int i = 1; i <= int.Parse(Notes["Stat"]["NumOfDef"].ToString()); i++)
                    {
                        string str = Notes["Cards"]["Def"][i.ToString()]["Title"].ToString();
                        if (Notes["Cards"]["Def"][i.ToString()]["Title"].ToString().Length > "四个汉字".Length)
                        {
                            str = Notes["Cards"]["Def"][i.ToString()]["Title"].ToString().Substring(0, "四个汉字".Length) + "…";
                        }
                        AddWhereList.Add(new listMain()
                        {
                            ID = i, Name = "  " + str
                        });
                    }
                    AddWhere.ItemsSource       = AddWhereList;
                    AddWhere.DisplayMemberPath = "Name";
                    AddWhere.SelectedValuePath = "ID";
                    AddWhere.SelectedValue     = 0;
                    this.AdW.Visibility        = Visibility.Visible;
                }
                else
                {
                    this.AdW.Visibility = Visibility.Collapsed;
                }
            }
            catch (Exception ex)
            {
                SSMessageHelper.noNo = false;
                ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                SSMessageHelper.Title   = "读取JSON错误";
                SSMessageHelper.bNOtext = "不用不用";
                SSMessageHelper.bOKtext = "打开日志";
                SSMessageHelper.Says    = "我们发现了一个崩溃性的错误,是否反馈它,如果不反馈,这个错误将永远得不到修复!\n" + ex;
                SSMessageBox MB = new SSMessageBox();
                ParentWindow.IsMaskVisible = true;
                MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                MB.Owner = ParentWindow;
                MB.ShowDialog();
                ParentWindow.IsMaskVisible = false;

                error.logWriter("Tool7:读取JSON错误。" + ex, false);
                if (SSMessageHelper.buttonOK)
                {
                    string where = Directory.GetCurrentDirectory();
                    where        = where + @"\SSTB\Log\log.log";
                    Process process;
                    process = System.Diagnostics.Process.Start(@where);
                    System.Diagnostics.Process.Start("https://ssteamcommunity.wordpress.com/feedback/");
                }
                Application.Current.Shutdown();
            }
        }
예제 #6
0
파일: Page7.xaml.cs 프로젝트: op07n/test23
        private void RunButton_Click(object sender, RoutedEventArgs e)
        {
            if (err)
            {
                return;
            }
            if (!CD2.IsVisible)      //显示添加卡片
            {
                AddWhat.SelectedValue  = 0;
                AddWhere.SelectedValue = 0;
                What.Text           = "";
                this.CD2.Visibility = Visibility.Visible;
            }
            else                    //关闭添加卡片并且开始添加操作
            {
                if ((String.IsNullOrWhiteSpace(What.Text) && int.Parse(AddWhat.SelectedValue.ToString()) == 1) || (int.Parse(AddWhat.SelectedValue.ToString()) == 0) || (int.Parse(AddWhat.SelectedValue.ToString()) == 2 && String.IsNullOrWhiteSpace(What.Text) && (int.Parse(AddWhere.SelectedValue.ToString()) == 0)))
                {
                    this.CD2.Visibility = Visibility.Collapsed;
                    return;
                }
                if (bool.Parse(CanDel.IsChecked.ToString()))
                {
                    SSMessageHelper.noNo = false;
                    ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                    SSMessageHelper.Title = "确认一下";
                    SSMessageHelper.Says  = "真的要选择无法删除嘛,这会导致此记录无法选择删除。(你只能通过“完成”选项来消除此记录,我希望你可以好好利用这个功能来督促自己)";
                    SSMessageBox MB = new SSMessageBox();
                    ParentWindow.IsMaskVisible = true;
                    MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                    MB.Owner = ParentWindow;
                    MB.ShowDialog();
                    ParentWindow.IsMaskVisible = false;
                    if (SSMessageHelper.buttonNO)
                    {
                        return;
                    }
                }
                try
                {
                    if (int.Parse(AddWhat.SelectedValue.ToString()) == 1)
                    {
                        JObject CardItem = new JObject();
                        int     num      = int.Parse(Notes["Stat"]["NumOfDef"].ToString());
                        Notes["Stat"]["NumOfDef"] = (num + 1).ToString();
                        num += 1;
                        CardItem["Title"]    = What.Text;
                        CardItem["Stat"]     = "0";
                        CardItem["Finished"] = "0";
                        Notes["Cards"]["Def"][num.ToString()] = CardItem;
                        SaveData(Notes);
                        int[] things = new int[1];
                        things[0] = int.Parse(Notes["Stat"]["NumOfDef"].ToString());
                        AddColtrols(int.Parse(AddWhat.SelectedValue.ToString()), things, What.Text);
                    }
                    if (int.Parse(AddWhat.SelectedValue.ToString()) == 2)
                    {
                        int num = int.Parse(Notes["Cards"]["Def"][AddWhere.SelectedValue.ToString()]["Stat"].ToString());
                        Notes["Cards"]["Def"][AddWhere.SelectedValue.ToString()]["Stat"] = (num + 1).ToString();
                        num += 1;
                        JObject Item = new JObject {
                            { "Title", What.Text }, { "Finished", false }, { "CantDel", bool.Parse(CanDel.IsChecked.ToString()) }
                        };
                        Notes["Cards"]["Def"][AddWhere.SelectedValue.ToString()][num.ToString()] = Item;
                        SaveData(Notes);
                        int[] things = new int[3];
                        things[0] = int.Parse(Notes["Cards"]["Def"][AddWhere.SelectedValue.ToString()]["Stat"].ToString());
                        things[1] = int.Parse(AddWhere.SelectedValue.ToString());
                        if (bool.Parse(CanDel.IsChecked.ToString()))
                        {
                            things[2] = 1;
                        }
                        else
                        {
                            things[2] = 0;
                        }
                        AddColtrols(int.Parse(AddWhat.SelectedValue.ToString()), things, What.Text);
                    }
                }
                catch (Exception ex)
                {
                    SSMessageHelper.noNo = false;
                    ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                    SSMessageHelper.Title   = "写入JSON错误";
                    SSMessageHelper.bNOtext = "不用不用";
                    SSMessageHelper.bOKtext = "打开日志";
                    SSMessageHelper.Says    = "我们发现了一个崩溃性的错误,是否反馈它,如果不反馈,这个错误将永远得不到修复!\n" + ex;
                    SSMessageBox MB = new SSMessageBox();
                    ParentWindow.IsMaskVisible = true;
                    MB.WindowStartupLocation   = WindowStartupLocation.CenterOwner;
                    MB.Owner = ParentWindow;
                    MB.ShowDialog();
                    ParentWindow.IsMaskVisible = false;

                    error.logWriter("Tool7:读取JSON错误。" + ex, false);
                    if (SSMessageHelper.buttonOK)
                    {
                        string where = Directory.GetCurrentDirectory();
                        where        = where + @"\SSTB\Log\log.log";
                        Process process;
                        process = System.Diagnostics.Process.Start(@where);
                    }
                    Application.Current.Shutdown();
                }
                this.CD2.Visibility = Visibility.Collapsed;
                this.AdW.Visibility = Visibility.Collapsed;
            }
        }