当前位置: 首页>>代码示例>>C#>>正文


C# Connector类代码示例

本文整理汇总了C#中Connector的典型用法代码示例。如果您正苦于以下问题:C# Connector类的具体用法?C# Connector怎么用?C# Connector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Connector类属于命名空间,在下文中一共展示了Connector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AnalysisStatisticForm

        public AnalysisStatisticForm(List<string> words, Connector.Redmine.Model.Issue task)
        {
            InitializeComponent();
            Logger.TextChanged += (sender, e) =>
            {
                resultTextBox.Text = e;
            };
            resultTextBox.TextChanged += (sender, e) =>
            {
                resultTextBox.SelectionStart = resultTextBox.TextLength;
                resultTextBox.ScrollToCaret();
            };
            _words = words;
            _task = task;
            Logger.LogHtml("<h1>Статистический анализ</h1>");
            Logger.LogText("Статистический анализ");

            // get frequency of words
            var freqLib = new TA.Statistic.Frequency(_words);
            var orderedWords = freqLib.Process().OrderByDescending(i => i.count);

            // log it
            Logger.LogHtml("<h2>Частота употребления слов</h2><ul>");
            Logger.LogText("ЧАСТОТА УПОТРЕБЛЕНИЯ СЛОВ:");
            foreach (var item in orderedWords)
            {
                Logger.LogHtml(string.Format("<li><strong>{0}</strong> — {1}</li>", item.word, item.count));
                Logger.LogText(string.Format("  {0} — {1}", item.word, item.count));
            }
            resultTextBox.Text += "\r\n";
            Logger.LogHtml("</ul>");
        }
开发者ID:CrazyBread,项目名称:TextAnalyzer,代码行数:32,代码来源:AnalysisStatisticForm.cs

示例2: SaveInfo

    //saves the information of the Fetcher and return the ID from the database
    public string SaveInfo(string Server = "")
    {
        Connector js;
         if (Server == "")
         {
             js = new Connector();
         }
         else
         {
             js = new Connector(Server, "Kids_Checkin", "kidchurch", "[email protected]");
         }

         string fldPicture = this.FirstName + this.LastName + ".jpg";

         this.Image.Save(js.GetPath() + "/Fetchers/" + fldPicture);

         string q = "INSERT INTO tblFetcher(fldFirstName,fldLastName,fldContactDetails,fldRelationship,fldPicture,fldEmail)" +
                               " VALUES('" + this.FirstName + "','" + this.LastName + "','" + this.ContactID + "','" + this.Relationship + "','" + fldPicture + "','" + this.Email + "')";

         js.ExecuteNonQuery(q);

         q = "SELECT fldID FROM tblFetcher WHERE fldLastName='" + this.LastName + "' AND fldFirstName ='" + this.FirstName + "' AND fldPicture='" + fldPicture + "'";

         js.ExecuteQuery(q);

         js.RiD.Read();

         return js.RiD["fldID"].ToString();
    }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:30,代码来源:InitialFetcher.cs

示例3: MainWindow

        //Instance of object which contains configuration for sending data.
        //ULoader_JSON config;
        //Instacje of object which sends data.
        //USender uSender;
        public MainWindow()
        {
            InitializeComponent();

            attentionValuesCollection = new DataCollection();

            var attentionDataSource = new EnumerableDataSource<Data>(attentionValuesCollection);
            attentionDataSource.SetXMapping(x => dateAttention.ConvertToDouble(x.Date));
            attentionDataSource.SetYMapping(y => y.Value);
            plotterAttention.AddLineGraph(attentionDataSource, Colors.Red, 2, "Attetion");

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.ConnectScan("COM3");

            //Stworzenie obiektu typu Random do wyboru losowego słowa ze słownika.
            randomWordNumber = new Random();

            wordNumber = 0;

            attentionComingCounter = 0;
            attentionValueSum = 0;
            puzzlesSolved = 0;
            wordStatList = new List<WordStat>();
            currentWord = "";

            //config = new ULoader_JSON(@"..\..\config.json");
            //uSender = config.GetSender("output1");
        }
开发者ID:Sektu,项目名称:MindwaveApp,代码行数:36,代码来源:MainWindow.xaml.cs

示例4: SubscribeLevel1

        /// <summary>
        /// Метод подписывает пользователя на получение новых значений Level1.
        /// Могут использовать только пользователи с ролями: "Level1", "Level2" и "Admin".
        /// </summary>
        /// <param name="security"></param>
        public static FaultException SubscribeLevel1(Connector connector, Security security, List<string> roles)
        {
            string[] rolesPermission = { "Level1", "Level2", "Admin" };   //Доступно ролям.

            if (rolesPermission.Intersect(roles).Any())
            {
                if (security != null)
                {
                    var criteria = new StockSharp.BusinessEntities.Security
                    {
                        Code = security.Ticker,
                        Id = security.Code,
                        Board = StockSharp.BusinessEntities.ExchangeBoard.Nyse
                    };
                    //Регистрируем инструмент для получения Level1
                    connector.RegisterSecurity(criteria);
                    Console.WriteLine("Register SECURITY {0}, {1}", connector.ConnectionState, connector.Id);
                }
                else
                {
                    return new FaultException("Значение инструмента не может быть неопределенным.");
                }
            }
            else
            {
                return new FaultException("Level1 недоступен для этого аккаунта.");
            }

            return null;
        }
开发者ID:AlexandrKalinovskiy,项目名称:QService,代码行数:35,代码来源:Support.cs

示例5: Main

    static void Main(string[] args)
    {
        NetConfig.LatencySimulation = true;
        Connector client = new Connector("Sample1.1", false);

        Clock fastClock = new Clock(0.02f);
        Clock slowClock = new Clock(1.0f);
        fastClock.OnFixedUpdate += SendPayload;
        slowClock.OnFixedUpdate += SendNotification;

        Program.peer = client.Connect("127.0.0.1:42324");

        while (true)
        {
          fastClock.Tick();
          slowClock.Tick();
          client.Update();

          if (Console.KeyAvailable)
          {
        ConsoleKeyInfo key = Console.ReadKey(true);
        switch (key.Key)
        {
          case ConsoleKey.F1:
            client.Stop();
            return;

          default:
            break;
        }
          }
        }
    }
开发者ID:ashoulson,项目名称:MiniUDP,代码行数:33,代码来源:Program.cs

示例6: UpdateDataTablesFromApi

        private void UpdateDataTablesFromApi(Connector connector)
        {
            // TODO  divide this big function?

            // updating users ...
            Console.Write("Updating users...");
            var userController = new UsersController(connector.mySqlConnection);
            var rateableUsers = userController.GetRateableUsers();
            var friends = new List<string>();
            foreach (string user in rateableUsers)
            {
                userController.FindAndInsertNewFriends(GetFriends(user));
            }
            Console.Write(" [DONE]\n");

            // searching for update...
            var usersForUpdate = userController.GetUsersWithOldUpdate();

            while (usersForUpdate != null)
            {
                break;
                // TODO 1: get for each user Dictionary<artist, number of songs>
                // TODO 1.1: fill "counts" table, if artist appeared for the 1st time, add him to "artists" table
                // TODO 2: check. (GetUsersWithOldUpdate again)
            }
        }
开发者ID:jerryjerryj,项目名称:VKLab,代码行数:26,代码来源:DailyUpdate.cs

示例7: DataFeed

        private List<string> _roles;   //Коллекция ролей пользователя. Служит для снижения нагрузки на базу данных при частых вызовах методов

        DataFeed()
        {
            _context = new EFDbContext();

            operationContext = OperationContext.Current;
            operationContext.Channel.Opened += Channel_Opened;
            operationContext.Channel.Closed += Channel_Closed;

            info = new Info();
            _uManager = new UManager(new UserStore<User>(new IdentityContext()));
            _user = _uManager.FindByName(operationContext.ServiceSecurityContext.PrimaryIdentity.Name); //Получаем текущего Identity пользователя 

            var roles = _uManager.GetUserRoles(_user.Id);  //Создадим список ролей пользователя к которым будем обращаться в методах для проверки, чтобы не загружать БД лишними запросами.

            _roles = roles.Select(r => r.Name).ToList();

            _conCount = roles.Max(r => r.NumberOfThreads);  //Установить максимальное количество потоков доступное из ролей данному пользователю

            _connector = GetAvialableConnector();
            _connector.ValuesChanged += Level1Changed;
            _connector.MarketDepthsChanged += Level2Changed;
            _connector.NewNews += NewNews;
            _connector.Error += Error;

            Console.WriteLine("SID: {0} ", operationContext.Channel.SessionId);

            _listener = new Listener(operationContext);

            //Запускаем вторичные потоки для обработки исторических данных
            for (int i = 0; i < _conCount; i++)
            {
                new Task(_listener.CandlesQueueStart).Start();
            }
        }
开发者ID:AlexandrKalinovskiy,项目名称:QService,代码行数:36,代码来源:DataFeed.cs

示例8: btn_connect_Click

        private void btn_connect_Click(object sender, EventArgs e)
        {
            // Initialize a new Connector and add event handlers
            connector = new Connector();

            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceFound += new EventHandler(OnDeviceFound);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);

            connector.DeviceDisconnected += new EventHandler(OnDeviceDisconnected);
            // Scan for devices across COM ports
            // The COM port named will be the first COM port that is checked.
            //string COM12 = null;

            connector.ConnectScan("COM40");
            //Thread.Sleep(45000);
            if (true)
            {
                progressBar2.Value = 0;
                Thread.Sleep(2000);
                progressBar2.Value = 20;
                Thread.Sleep(2000);
                progressBar2.Value = 40;
                Thread.Sleep(2000);
                progressBar2.Value = 60;
                Thread.Sleep(2000);
                progressBar2.Value = 80;
                Thread.Sleep(2000);
                progressBar2.Value = 100;
            }
        }
开发者ID:andrehendriks,项目名称:WindowsFormApplication1,代码行数:31,代码来源:Form1.cs

示例9: Main

        static void Main(string[] args)
        {
            //
            // TODO: Add code to start application here
            //
            if (args.Length != 2)
            {
                Console.WriteLine("Wrong number of arguments. Got {0} instead.", args.Length);
                return;
            }

            MyHandler myH = new MyHandler();
            Parameters p = new Parameters();
            p.ServerUrl = args[0];

            Connector c = new Connector();
            if (c.Open(p))
            {
                Message m = new Message();
                m.Set("do_method", "notify");
                m.Set("kn_to", args[1]);
                m.Set("kn_payload", "Hello");
                m.Set("nickname", "dotnet");
                m.Set("kn_response_format", "simple");

                c.Publish(m, myH);

                c.Close();
            }
        }
开发者ID:kragen,项目名称:mod_pubsub,代码行数:30,代码来源:Class1.cs

示例10: enable

 public static string enable(string pluginid, Connector conn)
 {
     string basePath = Misc.Plugins.getPluginBasePath(pluginid, conn);
     // Install content
     Misc.Plugins.contentInstall(basePath + "\\Content");
     return null;
 }
开发者ID:kassemshehady,项目名称:Uber-CMS,代码行数:7,代码来源:Page404.cs

示例11: SetConnectorPointsCommand

        internal SetConnectorPointsCommand(Connector connector, List<KeyValuePair<double, double>> edgePoints)
        {
            Debug.Assert(connector != null, "connector is null");

            _connector = connector;
            _edgePoints = edgePoints;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:SetConnectorPointsCommand.cs

示例12: requestEnd

 public static void requestEnd(string pluginid, Connector conn, ref Misc.PageElements pageElements, HttpRequest request, HttpResponse response)
 {
     bool cookiesEnabled = request.Cookies["cookie-control"] != null;
     // Add styling and toggle button
     Misc.Plugins.addHeaderCSS(pageElements["URL"] + "/Content/CSS/CookieControl.css", ref pageElements);
     Misc.Plugins.addHeaderJS(pageElements["URL"] + "/Content/JS/CookieControl.js", ref pageElements);
     // Add toggle button
     pageElements.appendToKey("BODY_FOOTER", Core.templates["cookiecontrol"]["toggle"]);
     // Add warning banner
     if (!cookiesEnabled)
         pageElements.appendToKey("BODY_HEADER", Core.templates["cookiecontrol"]["banner"]);
     else
     {
         // Check if cookies have been enabled, if so return - no need to remove cookies
         pageElements.setFlag("COOKIES_ON");
         return;
     }
     // Clear all the response cookies - these may have been added programmatically
     response.Cookies.Clear();
     // Add each cookie, sent in the request, in the response - to expire
     HttpCookie cookie;
     for (int i = 0; i < request.Cookies.Count; i++)
     {
         cookie = request.Cookies[i];
         if (cookie.Name != "ASP.NET_SessionId")
         {
             cookie.Expires = DateTime.Now.AddDays(-2);
             response.Cookies.Add(cookie);
         }
     }
 }
开发者ID:kassemshehady,项目名称:Uber-CMS,代码行数:31,代码来源:Base.cs

示例13: SaveInfo

    //saves the information of the Kid and return the ID from the database
    public string SaveInfo(string Server="")
    {
        Connector js;
        if(Server=="")
        {
            js = new Connector();
        }
        else
        {
            js = new Connector(Server, "Kids_Checkin", "kidschurch", "[email protected]");
        }

        string fldPicture = this.FirstName + this.LastName + ".jpg";

        this.img.Save(js.GetPath() + "/Kids/" + fldPicture);

        string q = "INSERT INTO tblKids(fldStudentID,fldFirstName,fldLastName,fldNickName,fldBirthday,fldChurch,fldDateCreated,fldPicture,fldGender,fldAllergies)" +
                    " VALUES('" + this.StudentID + "','" + this.FirstName + "','" + this.LastName + "','" +  this.NickName + "','" + this.BirthDay + "','" + this.ChurchID + "','" + DateTime.Now.ToShortDateString() + "','" +  fldPicture + "','" + this.Gender + "','" + this.Allergies + "')";

        js.ExecuteNonQuery(q);

        q = "SELECT fldID FROM tblKids WHERE fldStudentID='" + this.StudentID + "'";

        js.ExecuteQuery(q);

        js.RiD.Read();

        return js.RiD["fldID"].ToString();
    }
开发者ID:meanprogrammer,项目名称:KidsCheckinSystem,代码行数:30,代码来源:Kids.cs

示例14: SubItemConnector

 /// <summary>
 /// Creates a new subitem used to visualise a connected child on the node.
 /// </summary>
 /// <param name="connector">The connector we want to visualise.</param>
 /// <param name="child">The child represented by the subitem. Can be null.</param>
 /// <param name="index">The index of the child in the connector. Also a null child has an index!</param>
 public SubItemConnector(Connector connector, BaseNode child, int index)
     : base(null, null, __font, Brushes.White, Alignment.Right, true)
 {
     _connector = connector;
     _child = child;
     _index = index;
 }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:13,代码来源:NodeViewData.SubItemConnector.cs

示例15: Connection

 public Connection(Connector source, Connector sink)
 {
     this.ID = Guid.NewGuid();
     this.Source = source;
     this.Sink = sink;
     base.Unloaded += new RoutedEventHandler(Connection_Unloaded);
 }
开发者ID:hardborn,项目名称:StadiumBrightnessTool,代码行数:7,代码来源:Connection.cs


注:本文中的Connector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。