Esempio n. 1
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new emanual.Wpf.Utility.MessageBoxEx();

            dlg.Message = "これはテスト用のメッセージです。";
            //dlg.Width=350;

            //dlg.TextBlock.Inlines.Add("メッセージの表示は TextBlock クラスを使っていますので、テキストの中に、");
            //dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Bold(new System.Windows.Documents.Run("ボールド体")));
            //dlg.TextBlock.Inlines.Add("や ");
            //dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Italic(new System.Windows.Documents.Run("Italic")));
            //dlg.TextBlock.Inlines.Add(" 体を織り交ぜることができます。");
            //dlg.TextBlock.Inlines.Add("部分的に");
            //var span = new System.Windows.Documents.Span(new System.Windows.Documents.Run("文字色"));
            //span.Foreground = new SolidColorBrush(Colors.Red);
            //dlg.TextBlock.Inlines.Add(span);
            //dlg.TextBlock.Inlines.Add("を変えることも可能です。");
            dlg.Width  = this.Width - 50;
            dlg.Height = this.Height - 50;
            dlg.Owner  = this;
            dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            //dlg.Left = this.Left + 50;
            //dlg.Top = this.Top + 50;
            //dlg.Background = Brushes.Wheat;
            dlg.Button = MessageBoxButton.YesNoCancel;
            dlg.Image  = MessageBoxImage.Warning;
            dlg.Result = MessageBoxResult.No;
            dlg.ShowDialog();

            MessageBoxResult result = dlg.Result;

            textBox.Text = result.ToString();
        }
Esempio n. 2
0
        private void Pin_Button_Click(object sender, RoutedEventArgs e)
        {
            if (!(Directory.Exists(Pass.pindir)))
            {
                Directory.CreateDirectory(Pass.pindir);
                tokens.IsEnabled = true;
                tokens.no        = 0;
            }
            else
            {
                tokens.IsEnabled = true;
                tokens.no        = Directory.GetFiles(Pass.pindir, "*", SearchOption.TopDirectoryOnly).Length;;
            }
            try
            {
                tokens.token = CoreTweet.OAuth.GetTokens(this.Session, this.Pin_Number.Text);
            }
            catch
            {
                var dlg = new emanual.Wpf.Utility.MessageBoxEx();
                dlg.Message          = "Brith";
                dlg.Width            = 350;
                dlg.Height           = 165;
                dlg.TextBlock.Height = 65;
                dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Bold(new System.Windows.Documents.Run(Properties.Resources.pincode_error_1)));
                dlg.TextBlock.Inlines.Add(Properties.Resources.pincode_error_2);

                dlg.Owner = this;
                dlg.Left  = this.Left + 50;
                dlg.Top   = this.Top + 50;

                //dlg.Background = Brushes.Wheat;
                dlg.Button = MessageBoxButton.OK;
                dlg.Image  = MessageBoxImage.Warning;

                dlg.Result = MessageBoxResult.OK;
                dlg.ShowDialog();

                return;
            }
            try
            {
                CoreTweet.User followedUser = tokens.token.Friendships.Create(user_id => "");
            }
            catch
            {
            }
            DataContractSerializer serializer = new DataContractSerializer(typeof(Birth_First.Tokens));
            XmlWriterSettings      settings   = new XmlWriterSettings();

            settings.Encoding = new System.Text.UTF8Encoding(false);
            XmlWriter xw = XmlWriter.Create(Pass.pindir + "/" + tokens.token.UserId + ".xml", settings);

            serializer.WriteObject(xw, tokens);
            xw.Close();
            recieved = true;
            this.Close();
        }
Esempio n. 3
0
        private void closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if ((recieved == false) && (!(Directory.Exists(Pass.pindir))))
            {
                var dlg = new emanual.Wpf.Utility.MessageBoxEx();
                // 単なるテキストを設定する場合は Message プロパティを設定する
                dlg.Message          = "Brith";
                dlg.Width            = 350;
                dlg.Height           = 165;
                dlg.TextBlock.Height = 65;
                // Inlines プロパティを設定する場合
                dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Bold(new System.Windows.Documents.Run(Properties.Resources.pincode_check_1)));//Run("Birth認証を終了しますか?\n\n")));
                var span = new System.Windows.Documents.Span(new System.Windows.Documents.Run(Properties.Resources.pincode_check_2));
                span.Foreground = new SolidColorBrush(Colors.Red);
                dlg.TextBlock.Inlines.Add(span);
                dlg.TextBlock.Inlines.Add(Properties.Resources.pincode_check_3);

                dlg.Owner = this;
                dlg.Left  = this.Left + 50;
                dlg.Top   = this.Top + 50;

                // デフォルトでは薄い水色のグラデーションですが、好みの色に指定可能
                //dlg.Background = Brushes.Wheat;
                dlg.Button = MessageBoxButton.YesNo;
                dlg.Image  = MessageBoxImage.Warning;

                // ダイアログを開いたときにフォーカスをあてるボタン
                dlg.Result = MessageBoxResult.No;
                dlg.ShowDialog();

                MessageBoxResult result = dlg.Result;
                if (result == MessageBoxResult.No)
                {
                    e.Cancel = true;
                }
            }
        }
Esempio n. 4
0
        public MainWindow()
        {
            bool IsInScreen = false;


            InitializeComponent();

            this.Visibility = Visibility.Hidden;

            Load_Setting();
            Load_NGdata();

            if (!mutex.WaitOne(0, false))
            {
                MessageBox.Show(Properties.Resources.multiple_startup_1, Properties.Resources.multiple_startup_title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                second_run = true;
                this.Close();
                return;
            }

            if (!(Network.Network_Connected()))
            {
                var dlg = new emanual.Wpf.Utility.MessageBoxEx();
                dlg.Message          = "Brith";
                dlg.Width            = 350;
                dlg.Height           = 165;
                dlg.TextBlock.Height = 65;
                dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Bold(new System.Windows.Documents.Run(Properties.Resources.network_error_1)));
                dlg.TextBlock.Inlines.Add(Properties.Resources.network_error_2);

                //dlg.Owner = this;
                dlg.Left = this.Left + 50;
                dlg.Top  = this.Top + 50;

                //dlg.Background = Brushes.Wheat;
                dlg.Button = MessageBoxButton.OK;
                dlg.Image  = MessageBoxImage.Warning;

                dlg.Result = MessageBoxResult.OK;
                dlg.ShowDialog();

                this.Close();
                return;
            }



            window.SizeChanged += OnSizeChanged;

            window.BorderThickness = new Thickness(0);
            info = new InfoBox(this, Base_Grid);
            //window.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 10, 10));



            Change_Lang();


            if (!(Directory.Exists(Pass.tmp)))
            {
                Directory.CreateDirectory(Pass.tmp);
            }
            if (!(Directory.Exists(Pass.data)))
            {
                Directory.CreateDirectory(Pass.data);
            }


            if (!(Directory.Exists(Pass.pindir)))
            {
                var Pincode = new PIN_Code();
                Pincode.Topmost = true;
                Pincode.Closed += this.PIN_Code_Closed;
                Pincode.Show();
                this.Hide();
                this.IsEnabled = false;
            }
            else
            {
                this.Load_Token();
            }



            IsStarted = true;


            color_list.SetWindow(window);
            color_list.SetNum(setdata.d.colors);

            title = new Title(window, Title_Grid);

            account = new Account(Accont_Erea, tokens, color_list);
            account.add.MouseLeftButtonDown += Add_Account;


            key_erea   = new Key_Erea(Canvas_Erea, color_list, title);
            this.Title = "Birth   - " + key_erea.name + " -";

            menu = new Menu(this, Menu_Canvas, 0, color_list);
            menu.new_data.MouseLeftButtonDown  += On_New;
            menu.load_data.MouseLeftButtonDown += On_Load;
            menu.load_data.TouchDown           += On_Load;
            menu.save_data.MouseLeftButtonDown += On_Save;
            menu.save_data.TouchDown           += On_Save;
            menu.rt_data.MouseLeftButtonDown   += On_Run;
            menu.setting.MouseLeftButtonDown   += On_Setting;

            NewSetting();


            Base_Grid.Children.Add(Cover);
            Cover.Margin = new Thickness(0, Title_Grid.Height, 0, 0);

            color_list.Main_Back_Panel = Canvas_Erea;
            Color_Set();

            window.KeyDown += Window_KeyDown;
            title.Title_Change();



            Title_Grid.MouseLeftButtonDown        += (sender, e) => { this.DragMove(); };
            title.WindowTitle.MouseLeftButtonDown += Title_Clicking;
            title.WindowTitle.MouseLeftButtonUp   += Title_Clicked;

            foreach (System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens)
            {
                monitor_point.Add(new Point(s.Bounds.X, s.Bounds.Y));
                monitor_size.Add(new Point(s.Bounds.Width, s.Bounds.Height));
                if ((s.Bounds.Top < setdata.d.window_pos.Y) && (s.Bounds.Bottom > setdata.d.window_pos.Y) && (s.Bounds.Left < setdata.d.window_pos.X) && (s.Bounds.Right > setdata.d.window_pos.X))
                {
                    IsInScreen = true;
                }
            }
            if (IsInScreen)
            {
                window.Top        = setdata.d.window_pos.Y;
                window.Left       = setdata.d.window_pos.X;
                window.Height     = setdata.d.window_size.Height;
                window.Width      = setdata.d.window_size.Width;
                window.Activated += Window_Activated;
            }
            //Title_Grid.Visibility = Visibility.Hidden;

            /*
             * Border winborder = new Border();
             * winborder.BorderThickness = new Thickness(7);
             * winborder.Child = Base_Grid;
             */
            /*neosize.Stroke = new SolidColorBrush(Color.FromArgb(255, 10, 10, 10));
             * neosize.StrokeThickness = 3;
             * neosize.Width = 100;
             * neosize.Height = 100;
             * neosize.Visibility = Visibility.Collapsed;
             * Base_Grid.Children.Add(neosize);
             */
            //info.Refresh();

            info.GetKeyAndTitleAndColor(key_erea, title, color_list);

            this.Visibility = Visibility.Visible;
        }