Ejemplo n.º 1
0
		public void GetStyleByName()
		{
			TextDocument document = new TextDocument();
			document.New();
			StyleCollection collection = new StyleCollection();
			collection.Add(new TableStyle(document, "a"));
			collection.Add(new TableStyle(document, "b"));
			IStyle nullStyle = new TableStyle(document, string.Empty);
			collection.Add(nullStyle);
			
			Assert.AreEqual("a", collection.GetStyleByName("a").StyleName);
			Assert.AreEqual("b", collection.GetStyleByName("b").StyleName);
			Assert.AreEqual(nullStyle, collection.GetStyleByName(string.Empty));
		}
Ejemplo n.º 2
0
        public void GetStyleByName()
        {
            TextDocument document = new TextDocument();

            document.New();
            StyleCollection collection = new StyleCollection();

            collection.Add(new TableStyle(document, "a"));
            collection.Add(new TableStyle(document, "b"));
            IStyle nullStyle = new TableStyle(document, string.Empty);

            collection.Add(nullStyle);

            Assert.AreEqual("a", collection.GetStyleByName("a").StyleName);
            Assert.AreEqual("b", collection.GetStyleByName("b").StyleName);
            Assert.AreEqual(nullStyle, collection.GetStyleByName(string.Empty));
        }
        public FormSelectStartType()
        {
            InitializeComponent();
            TopMost           = true;
            this.DoubleClick += Form_DoubleClick_Feature;
            this.Shown       += (s, e) =>
            {
                new Thread(() =>
                {
                    bool waiting = true;
                    #region wait animation
                    new Thread(() =>
                    {
                        btn_update.Invoke(new MethodInvoker(() =>
                        {
                            btn_update.Visible = true;
                            btn_update.Enabled = false;
                        }));
                        int animatoinStep = 1;
                        do
                        {
                            try
                            {
                                btn_update.Invoke(new MethodInvoker(() =>
                                {
                                    switch (animatoinStep)
                                    {
                                    case 1:
                                        btn_update.Text = @" / / / ";
                                        animatoinStep++;
                                        break;

                                    case 2:
                                        btn_update.Text = @" | | | ";
                                        animatoinStep++;
                                        break;

                                    case 3:
                                        btn_update.Text = @" \ \ \ ";
                                        animatoinStep   = 1;
                                        break;
                                    }
                                }));
                                Thread.Sleep(250);
                            }
                            catch { }
                        } while (waiting);
                    })
                    {
                        IsBackground = true
                    }.Start();
                    #endregion
                    var updater = new GitUpdater();
                    again:
                    bool needUpdate = updater.NeedUpdate;
                    if (needUpdate)
                    {
                        waiting = false;
                        btn_update.Invoke(new MethodInvoker(() =>
                        {
                            btn_update.Visible = true;
                            btn_update.Enabled = true;
                            btn_update.Text    = "Обновить";
                        }));
                    }
                    else
                    {
                        if (!GitUpdater.IsInternetExists())
                        {
                            goto again;
                        }
                        try
                        {
                            waiting = false;
                            btn_update.Invoke(new MethodInvoker(() =>
                            {
                                btn_update.Visible = true;
                                btn_update.Enabled = false;
                                btn_update.Text    = "Обновлений нет";
                            }));
                        }
                        catch { }
                    }
                })
                {
                    IsBackground = true
                }.Start();
                new Thread(() =>
                {
                    try
                    {
                        Thread.Sleep(TimeSpan.FromSeconds(2));
                        Invoke(new MethodInvoker(() =>
                        {
                            TopMost = false;
                        }));
                    }
                    catch { }
                }).Start();
            };

            // for game
            updateFrame = new System.Windows.Forms.Timer()
            {
                Enabled  = false,
                Interval = 200
            };
            updateFrame.Tick += (ss, ee) => UpdateFrame();

            // for combobox style
            foreach (var item in StyleCollection.Styles)
            {
                cb_style.Items.Add((item as StyleNotebook).Name);
            }
            cb_style.SelectedIndexChanged += (s, e) =>
            {
                string selectedStyleName = cb_style.Items[cb_style.SelectedIndex].ToString();
                StyleApply.CurrentStyle = StyleCollection.GetStyleByName(selectedStyleName);
                StyleApply.ForForm(this);

                ConfigCollection.Instance.SelectedFormStyleName = selectedStyleName;
            };
            cb_style.Text = StyleCollection.GetStyleByName(ConfigCollection.Instance.SelectedFormStyleName).Name;

            StyleApply.ForForm(this);
        }