コード例 #1
0
ファイル: test4.xaml.cs プロジェクト: imjihun/EglobalStudy
        void InitServerCommandView()
        {
            CommandView commandView;

            commandView = new CommandView();
            //grid_second.Children.Add(commandView);
        }
コード例 #2
0
ファイル: test4.xaml.cs プロジェクト: imjihun/EglobalStudy
        void initServerTab()
        {
            // UI 초기화
            ServerGrid servergrid = new ServerGrid();

            grid_server.Children.Add(servergrid);
            ServerMenuButton[] smbtn = new ServerMenuButton[ServerInfo.CATEGORIES.Length];
            for (int i = 0; i < ServerInfo.CATEGORIES.Length; i++)
            {
                ServerInfo.jobj_root.Add(new JProperty(ServerInfo.CATEGORIES[i], new JObject()));
                smbtn[i] = new ServerMenuButton(ServerInfo.CATEGORIES[i]);
                servergrid.Children.Add(smbtn[i]);
                ServerGrid.current.submenu.Children.Add(smbtn[i].child);
            }
            smbtn[0].IsChecked = true;

            CommandView commandView;

            commandView = new CommandView();
            grid_second.Children.Add(commandView);


            // serverinfo.json 파일 로드
            FileInfo fi = new FileInfo(ServerInfo.PATH);

            if (fi.Exists)
            {
                string json = FileContoller.read(ServerInfo.PATH);
                try
                {
                    ServerInfo.jobj_root = JObject.Parse(json);
                    List <ServerInfo>[] serverinfos = ServerInfo.ConvertFromJson(ServerInfo.jobj_root);
                    for (int i = 0; i < ServerInfo.CATEGORIES.Length; i++)
                    {
                        for (int j = 0; j < serverinfos[i].Count; j++)
                        {
                            smbtn[i].child.Items.Add(new ServerInfoTextBlock(serverinfos[i][j]));
                        }
                    }
                    //for(int i = 0; i < ServerInfo.CATEGORIES.Length; i++)
                    //{
                    //	JObject jobj = ServerInfo.jobj_root[ServerInfo.CATEGORIES[i]] as JObject;
                    //	ServerInfo si;
                    //	foreach(var v in jobj.Properties())
                    //	{
                    //		si = ServerInfo.ConvertFromJson(v);
                    //		smbtn[i].child.Items.Add(new ServerInfoTextBlock(si));
                    //	}
                    //}
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
コード例 #3
0
        public CommandView()
        {
            current         = this;
            this.Visibility = Visibility.Hidden;

            textBlock_server_name                   = new TextBlock();
            textBlock_server_name.Margin            = new Thickness(5, 5, 95, 5);
            textBlock_server_name.VerticalAlignment = VerticalAlignment.Top;
            this.Children.Add(textBlock_server_name);

            TextBlock command = new TextBlock();

            command.Text                = "Command :";
            command.Margin              = new Thickness(5, 35, 5, 5);
            command.Width               = 70;
            command.VerticalAlignment   = VerticalAlignment.Top;
            command.HorizontalAlignment = HorizontalAlignment.Left;
            this.Children.Add(command);

            textBox_command                     = new TextBox();
            textBox_command.Margin              = new Thickness(80, 35, 95, 5);
            textBox_command.VerticalAlignment   = VerticalAlignment.Top;
            textBox_command.HorizontalAlignment = HorizontalAlignment.Stretch;
            textBox_command.KeyDown            += TextBox_command_KeyDown;
            textBox_command.FontFamily          = new FontFamily("Consolas");
            this.Children.Add(textBox_command);

            Button btn_send = new Button();

            btn_send.Background          = Brushes.White;
            btn_send.Content             = "Send(or Run)";
            btn_send.Margin              = new Thickness(5, 35, 5, 5);
            btn_send.VerticalAlignment   = VerticalAlignment.Top;
            btn_send.HorizontalAlignment = HorizontalAlignment.Right;
            btn_send.Width  = 85;
            btn_send.Click += Button_send_Click;
            this.Children.Add(btn_send);

            textBox_result              = new TextBox();
            textBox_result.IsReadOnly   = true;
            textBox_result.Margin       = new Thickness(5, 60, 5, 5);
            textBox_result.TextWrapping = TextWrapping.Wrap;
            textBox_result.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            textBox_result.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            textBox_result.FontFamily   = new FontFamily("Consolas");
            textBox_result.TextChanged += TextBox_result_TextChanged;
            this.Children.Add(textBox_result);

            //timer_read = new DispatcherTimer();
            //timer_read.Interval = TimeSpan.FromSeconds(0.001);
            //timer_read.Tick += Timer_read_Tick;
        }
コード例 #4
0
ファイル: test4.xaml.cs プロジェクト: imjihun/EglobalStudy
            public static void refresh(ServerInfoTextBlock sitb)
            {
                if (current == null)
                {
                    return;
                }

                CommandView.clear();
                current.textBlock_server_name.Text = sitb.serverinfo.name + " / " + sitb.serverinfo.ip + " / " + sitb.serverinfo.id /*+ " / " + sitb.serverinfo.password*/;

                if (CommandView.current == null)
                {
                    return;
                }
                CommandView.current.textBox_command.Focus();
            }
コード例 #5
0
ファイル: test4.xaml.cs プロジェクト: imjihun/EglobalStudy
            protected override void OnSelectionChanged(SelectionChangedEventArgs e)
            {
                base.OnSelectionChanged(e);
                if (CommandView.current == null)
                {
                    return;
                }

                selected_server_info = this.SelectedItem as ServerInfoTextBlock;
                if (selected_server_info == null)
                {
                    CommandView.current.Visibility = Visibility.Hidden;
                    return;
                }
                else
                {
                    CommandView.current.Visibility = Visibility.Visible;
                }

                CommandView.refresh(selected_server_info);
            }
コード例 #6
0
ファイル: ServerInfo.cs プロジェクト: imjihun/EglobalStudy
        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            selected_serverinfo_textblock = this.SelectedItem as ServerInfoTextBlock;
            if (selected_serverinfo_textblock == null)
            {
                if (CommandView.current != null)
                {
                    CommandView.current.Visibility = Visibility.Hidden;
                }
                return;
            }

            if (CommandView.current != null)
            {
                CommandView.current.Visibility = Visibility.Visible;
            }
            CommandView.refresh(selected_serverinfo_textblock);

            LinuxTreeViewItem.Refresh();
        }