public void SetCurrentTL1Session()
        {
            HierarchicalObjectViewModel model = (HierarchicalObjectViewModel)ipexplorer.ObjectTree.SelectedItem;
            var ne = from x in template.NEs where x.Name == model.Name select x;
            NetworkElement NE = ne.First();

            SessionExplorer sessexp = SessionExplorer.obj;
            // establish TL1 session with NE's XCM
            NE_TL1 =  sessexp.GetSession(NE.IP, 9090);
        }
Пример #2
0
 public LogFile(TelnetSession session)
 {
     this.session = session;
     LogDirectory = Template.TemplateFileHandler.GetTemplateFileHandler().TemplateAbsolutePath + @"\SessionsLogs";
     string todaylogdir = LogDirectory + "\\" + DateTime.Today.Month + "-" + DateTime.Today.Day + "-" + DateTime.Today.Year;
     LogFilePathWithFile = todaylogdir + "\\" + session.SessionName + ".txt";
     Directory.CreateDirectory(todaylogdir);
     //System.Security.Permissions.FileIOPermissionAccess.
     // File.Open(todaylogdir + "\\" + "Hello.txt", FileMode.Create);
     LogFileStream = File.Open(LogFilePathWithFile, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
 }
Пример #3
0
        public SessionProperty(TelnetSession session)
        {
            telnetsession = session;
            InitializeComponent();
            this.Text = session.SessionName+ " - Session Property";

            // fill session name and connection parameter
            TextBox_SessionName.Text = telnetsession.SessionName;
            TextBox_ServerIP.Text = telnetsession.ServerIP;
            TextBox_PortNo.Text = Convert.ToString(telnetsession.ServerPort);
            //TextBox_BufferCount.Text = telnetsession.consolewindow.

            //TextBox_FontName.Text = telnetsession.FontFamily;
            //TextBox_FontSize.Text = telnetsession.FontSize;
        }
Пример #4
0
        private void okButton_Click(object sender, EventArgs e)
        {
            try {
                IPAddress ip;
                if(!IPAddress.TryParse(TextBox_ServerIP.Text, out ip))
                {
                    MessageBox.Show("IP address is not valid");
                    return;
                }else if (TextBox_PortNo.Text.Trim().Length== 0)
                {
                    MessageBox.Show("Port Number is not valid");
                    return;
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (newsession)
            {
                telnetsession = new TelnetSession(TextBox_ServerIP.Text, Convert.ToInt32(TextBox_PortNo.Text), TextBox_SessionName.Text,comboBox1.SelectedItem.ToString(), true,true,true);
                telnetsession.OnConnectCmdList.Add(textBox11.Text);
                telnetsession.OnConnectCmdList.Add(textBox12.Text);

            }
            else
            {
                //telnetsession.consolewindow.ConsoleTextBox.FontSize = Convert.ToDouble(TextBox_FontSize.Text);
                if (TextBox_ServerIP.Text != telnetsession.ServerIP || TextBox_PortNo.Text != telnetsession.ServerPort.ToString())
                {
                    telnetsession.SessionName = TextBox_ServerIP.Text;
                    telnetsession.ServerPort = Convert.ToInt32(TextBox_PortNo.Text);
                    telnetsession.Connect();
                    //telnetsession.StartReadingStreamThread();
                }

                telnetsession.OnConnectCmdList.Clear();
                telnetsession.OnConnectCmdList.Add(textBox11.Text);
                telnetsession.OnConnectCmdList.Add(textBox12.Text);
            }
        }
Пример #5
0
        private void DeleteSession(TelnetSession session)
        {
            var serversessions = from s in template.ServerSessions where s.Name == session.SessionName select s;
            if (serversessions.Count() == 0)
                return;

            template.ServerSessions.Remove(serversessions.First());
            SessionList.Remove(session);
            DeleteTreeItem(session.SessionName);
            session.Dispose();
            ReloadTree();
        }
Пример #6
0
        private void AddSession(TelnetSession session,bool openinlayoutdocument)
        {
            HierarchicalObjectViewModel tmp = AddTreeItem(session.SessionName);
            tmp.Image = @"..\Resources\Images\ServerSession\terminal.png";
            //Create ContextMenu of Build
            ContextMenu cm = new ContextMenu();
            MenuItem itm = new MenuItem() { Header = "Edit" };
            itm.Click += new RoutedEventHandler(Session_EditMenu_Click);
            cm.Items.Add(itm);

            itm = new MenuItem() { Header = "Log File" };
            itm.Click += new RoutedEventHandler(Session_LogFile_Click);
            cm.Items.Add(itm);

            itm = new MenuItem() { Header = "Log Directory" };
            itm.Click += new RoutedEventHandler(Session_LogDirectory_Click);
            cm.Items.Add(itm);

            itm = new MenuItem() { Header = "Delete" };
            itm.Click += new RoutedEventHandler(Session_DeleteMenu_Click);
            cm.Items.Add(itm);
            tmp.ContextMenuObj = cm;

            SessionList.Add(session);
            ReloadTree();
        }
Пример #7
0
        private TelnetSession AddSession(string ip, int port,string name, bool openinlayoutdocument, string sessionprotocol)
        {
            if (name == "")
            {
                name = ip + ":" + port;
            }
            TelnetSession telsession = new TelnetSession(ip, port,name,sessionprotocol, openinlayoutdocument,true,true);
            AddSession(telsession,openinlayoutdocument);

            return telsession;
        }
Пример #8
0
        private void QuickConnectToolBarButton_Click(object sender, RoutedEventArgs e)
        {
            string serverIp = Toolbar_QuickConnect_ServerIPTextBox.Text;
            string port = Toolbar_QuickConnect_ServerportTextBox.Text;
            string type = Toolbar_QuickConnect_ServerClientTextBox.Text;

            if (TempSessions == null)
                TempSessions = new List<TelnetSession>();

            TelnetSession session = new TelnetSession(serverIp, Convert.ToInt32(port), serverIp + ":" + port, type, true, false,false);
            session.Connect();
            TempSessions.Add(session);
        }