Ejemplo n.º 1
0
 public AddConnection(ConnectionCollection collection, Connections cons)
 {
     this.cons = cons;
     this.connections = collection;
     this.gxml = new Glade.XML(null, "irisim.glade", "addConnectionDialog", null);
     this.gxml.Autoconnect(this);
 }
Ejemplo n.º 2
0
 public EditConnection(ConnectionCollection con, string key)
 {
     this._connection_collection = con;
     this._edit_key = key;
     this._gxml = new Glade.XML(null, "irisim.glade", "editConnectionDialog", null);
     this._gxml.Autoconnect(this);
     this.PopulateFields();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the ChatManagerExtension class.
 /// </summary>
 /// <param name="context">The context, this extension runs in.</param>
 public ChatManagerExtension()
 {
     registredProtocols = new List<IProtocolExtension>();
     openConnections = new ConnectionCollection();
     configuredNetworks = new List<INetwork>();
     unloadedNetworks = new List<NetworkSettings>();
     openConnections.AddedConnection += new ConnectionEventHandler(openConnections_AddedConnection);
     openConnections.RemovedConnection += new ConnectionEventHandler(openConnections_RemovedConnection);
 }
Ejemplo n.º 4
0
            public UIBase()
            {
                this._controller = new Controller();
                this._controller.message_pump.ui_event += new UIEvent(this.UpdateConnectionStatus);
                this._controller.message_pump.ui_event += new UIEvent(this.UpdateEncryptionStatus);
                this._controller.message_pump.ui_event += new UIEvent(this.ErrorWatch);
                this._controller.message_pump.ui_event += new UIEvent(this.MessageWatch);
                this._chat_list_store = new ListStore(typeof(string), typeof(string));
                this._user_connections = new ConnectionCollection();
                this._user_accounts = new AccountCollection();
                this._user_chats = new Hashtable();
                this._current_chat = "";
                Application.Init();
                this.gxml = new Glade.XML(null, "irisim.glade", "chatWindow", null);
                this.gxml.Autoconnect(this);
                this.chatListView.FixedHeightMode = false;
                this.chatListView.HeadersVisible = true;
                this.chatListView.AppendColumn("Chats", new CellRendererText(), "text", 0);
                this.chatListView.Model = this._chat_list_store;
                this.chatListView.Selection.Changed += this.on_chatListView_changed;
                this.chatListView.ShowAll();

                Application.Run();
            }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            int port = 25567;
            foreach (string arg in args)
            {
                if (arg.Split('=').Length == 2)
                {
                    string variable, value;
                    variable = arg.Split('=')[0];
                    value = arg.Split('=')[1];

                    value.Replace("\"", "");

                    if (variable == "port")
                    {
                        int.TryParse(value, out port);
                    }
                }
            }

            localEndPoint = new IPEndPoint(IPAddress.Any, port);
            listener = new Listener(localEndPoint);
            listener.Connected += new ConnectedEventHandler(listener_Connected);
            listener.Listen();

            connections = new ConnectionCollection();
            AccountInformation.Load();

            #region Serverside CLI
            string input = "";
            while (input != "quit")
            {
                input = Console.ReadLine().ToLower();
                string[] pars = input.Split(' ');

                if (pars.Length > 0)
                {
                    if (pars[0] == "help")
                    {

                    }
                    else if (pars[0] == "hjalmar" && pars.Length == 2)
                    {
                        if (pars[1] == "suger")
                        {
                            Console.WriteLine("Correctly");
                        }
                    }
                    else if (pars[0] == "list")
                    {
                        if (pars.Length == 2)
                        {
                            if (pars[1] == "connections")
                            {
                                foreach (Connection connection in connections)
                                {
                                    WriteLine(connection, "is connected");
                                }
                            }
                            else if (pars[1] == "accounts")
                            {
                                foreach (Account account in AccountInformation.Accounts)
                                {
                                    Console.WriteLine(account.Name + ", " +
                                                  account.Password + ", " +
                                                  EnumName(account.AccountType) + ", " +
                                                  (account.IsBanned ? "Is banned" : "Is not banned"));
                                    Console.Write("Friends: ");
                                    foreach (Account friend in account.Friends)
                                    {
                                        Console.Write(friend.Name + ", ");
                                    }
                                    Console.Write("\nChannels: ");
                                    foreach (Channel channel in account.ChannelList)
                                    {
                                        Console.Write(channel.Name + ", ");
                                    }
                                    Console.WriteLine("\n---------------------------------");
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 6
0
        public void TestConnectionCollection()
        {
            var items = new ConnectionCollection { _conn, _connHost, _connFalse, _connJustTrueServer };

            items["Test"] = _conn;

            Assert.AreEqual(items["Test"].ConnectionString, _conn.ConnectionString);

            foreach (var cm in items.Select(x => new ConnectionManager(x)))
            {
                TestTools.ExceptException<SqlException>(() =>
                {
                    cm.Open();
                    Assert.IsTrue(cm.State == ConnectionState.Open);
                });
            }
        }
 public bool GetConnection(Guid connectionId, out ConnectionCollection <string> .ConnectionNode node)
 {
     return(this.connections.GetConnection(connectionId, out node));
 }
        private static void InitDatabases()
        {
            //construct collection
            ConnectionPool.m_databases = new ConnectionCollection();

            //populate collection
            for (int i = 0; i < ConfigurationManager.ConnectionStrings.Count; i++)
            {
                ConnectionConfiguration config = new ConnectionConfiguration(ConfigurationManager.ConnectionStrings[i].Name
                    , ConfigurationManager.ConnectionStrings[i].ConnectionString
                    , ConfigurationManager.ConnectionStrings[i].ProviderName
                    );
                ConnectionPool.Connections.Add(new ConnectionPool(config));
            }
        }
Ejemplo n.º 9
0
        private void AbstractFlowChartShape_OnMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (!(Site is GraphControl))
            {
                return;
            }
            if (Layer != Abstract.CurrentLayer)
            {
                return;
            }


            if (IsAutoConnect) //Auto connect and disconnect
            {
                if (LeftConnector == null)
                {
                    return;
                }

                //left connector has not been connected
                if (((GraphControl)Site).DoTrack)
                {
                    //Multiple selection
                    //if ((Site as GraphControl).SelectedShapes.Count > 1)
                    //{
                    //    ConnectionCollection t_selectedShapes = (Site as GraphControl).SelectedShapes;
                    //    if (IsLinkedAsOneGroup(t_selectedShapes))
                    //    {
                    //        Connector t_connector = FindConnectableConnectionForGroup(t_firstConnector, t_lastConnector);
                    //        if (t_connector == null) return;


                    //    }

                    //    return;
                    //}

                    //Is moving this shape
                    if (LeftConnector.Connections.Count == 0)
                    {
                        //left connector not connected, check if need to connect automatically
                        if ((Site as GraphControl).SelectedShapes.Count > 1)
                        {// no auto connect for group selection
                            return;
                        }

                        ConnectionCollection t_connections = Abstract.ConnectionsOfLayer(Layer.Name);
                        Connection           t_connection  = FindConnectableConnection(t_connections);
                        if (t_connection != null)
                        {
                            AttachToConnection(t_connection);
                            m_startPoint = e.Location;
                            return;
                        }

                        ShapeCollection t_shapes    = Abstract.ShapesOfLayer(Layer.Name);
                        Connector       t_connector = FindConnectableConnector(t_shapes);
                        if (t_connector != null)
                        {
                            AttachToConnector(t_connector);
                            m_startPoint = e.Location;
                            return;
                        }
                    }
                    else  //left connector has been connected
                    {
                        //check if need to remove connection for multiple shapes moving
                        if ((Site as GraphControl).SelectedShapes.Count > 1)
                        {
                            DetachConnectionsFromUnselectedShape();
                            return;
                        }

                        Connection t_vertical = GetLeftSideVerticalConnection();
                        if (t_vertical == null)
                        {
                            return;                     //no vertical connection, freely move shape
                        }
                        if (IsLeavingFromConnection(t_vertical))
                        {
                            int t_dx = (int)(e.Location.X - m_startPoint.X);
                            int t_dy = (int)(e.Location.Y - m_startPoint.Y);
                            if ((int)Math.Abs(t_dx) < m_autoShiftX)
                            {
                                StickToVerticalConnection(t_vertical);
                            }
                            else
                            {
                                DetachLeftSideConnections();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public ShellViewModel(IRegionManager regionManager, IRegionDialogService dialogService,
                              IConnectionService connectionService)
        {
            _regionManager     = regionManager;
            _dialogService     = dialogService;
            _connectionService = connectionService;

            // Page load command
            LoadCommand = new DelegateCommand(async() =>
            {
                // Get all connections from json configuration file
                var connection = await _connectionService.GetAllAsync();

                if (connection != null && connection.Count > 0)
                {
                    DispatcherService.BeginInvoke(() => Connections = connection);
                }
            });

            // Treeview item selection command
            NavCommand = new DelegateCommand <object>(async(item) =>
            {
                // Connection
                if (item is ConnectionInfo connection)
                {
                    // If connection is un-connecting or disconnected, start connection
                    if (!connection.IsConnecting && !connection.IsConnected)
                    {
                        await connection.ConnectAsync();
                    }
                    return;
                }

                // Database
                if (item is DatabaseInfo database)
                {
                    if (!database.IsInitialized)
                    {
                        await database.LoadKeyAsync(); // load all keys
                    }
                    return;
                }

                // Key
                if (item is KeyInfo key)
                {
                    _regionManager.ShowKeyViewer(key); // show key detail view
                    return;
                }
            });

            // New key view command
            NewKeyCommand = new DelegateCommand <DatabaseInfo>((database) =>
            {
                // Show new key view
                _dialogService.ShowNewKey(database, c =>
                {
                    // If add new key success, append the KeyInfo to the Treeview, not need reload the Treeview
                    if (c.Result == ButtonResult.OK)
                    {
                    }
                });
            });

            // New connection view command
            NewConnectionCommand = new DelegateCommand(() =>
            {
                // Show new connection view
                _dialogService.ShowNewConnection(c =>
                {
                    // If add new connection success, append the ConnectionInfo to the Treeview, not need reload the Treeview
                    if (c.Result == ButtonResult.OK &&
                        c.Parameters.TryGetValue <ConnectionInfo>("connection_info", out var connection) && connection != null)
                    {
                        // Maybe Treeview is null
                        if (Connections == null)
                        {
                            Connections = new ConnectionCollection();
                        }

                        Connections.Add(connection);
                    }
                });
            });
        }
Ejemplo n.º 11
0
 public Connections(ConnectionCollection c, AccountCollection a, FormBase base_window)
 {
     this._ui_base = base_window;
     this._connectionCollection = c;
 }