예제 #1
0
        private async void StartSearch()
        {
            if (!isSearchActive)
            {
                SearchResultsList.Text          = "";
                SearchResultsList.Height        = 0;
                isSearchActive                  = true;
                internetErrorPictureBox.Visible = false;
                Wrap.Visible = false;
                SearchResultsList.Visible = false;
                SideBar.Visible           = false;

                if (EventsRadioButton.Checked)
                {
                    await Task.Run(() =>
                    {
                        eventsRootObject = StartPredictHQSearchAsync().Result;
                    });

                    await Task.Run(() =>
                    {
                        SearchResultsList.Text = GetStringEventResultAsync().Result;
                        using (Graphics graphics = Graphics.FromHwnd(this.Handle))
                        {
                            SearchResultsList.Height = (int)Math.Round(graphics.MeasureString(SearchResultsList.Text, SearchResultsList.Font).Height) + 400;
                        }
                    });
                }
                else if (OrganizationsRadioButton.Checked)
                {
                    await Task.Run(() =>
                    {
                        rootObject = StartYandexSearchAsync().Result;
                    });

                    await Task.Run(() =>
                    {
                        SearchResultsList.Text = GetStringResultAsync().Result;
                        using (Graphics graphics = Graphics.FromHwnd(this.Handle))
                        {
                            SearchResultsList.Height = (int)Math.Round(graphics.MeasureString(SearchResultsList.Text, SearchResultsList.Font).Height) + 200;
                        }
                    });
                }

                SearchResultsList.Left           = Wrap.Width / 2 - SearchResultsList.Width / 2;
                SearchResultsList.SelectionStart = 0;
                isSearchActive = false;
                internetErrorPictureBox.Visible = true;
                Wrap.Visible = true;
                SearchResultsList.Visible = true;
                SideBar.Visible           = true;
                if (!NogginSwitcherCheckBox.Checked)
                {
                    MoveNogginLeftTimer.Enabled = true;
                }
            }
        }
예제 #2
0
 public EventsRootObject StartDeserializing()
 {
     using (FileStream sw = new FileStream(_fileName, FileMode.Open))
     {
         try
         {
             sw.Position       = 0;
             _eventsRootObject = new DataContractJsonSerializer(typeof(EventsRootObject)).ReadObject(sw) as EventsRootObject;
         }
         catch
         {
             MessageBox.Show("Ничего не найдео", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     return(_eventsRootObject);
 }
예제 #3
0
        public async Task <EventsRootObject> GetEvents(string groupId, int skip)
        {
            var events = new EventsRootObject();

            events.Metadata = new Meta();
            events.Events   = new List <Event>();
            for (int i = 0; i < 10; i++)
            {
                events.Events.Add(new Event
                {
                    Name = "Event name : " + i,
                    Id   = i.ToString()
                });
            }

            return(events);
        }
예제 #4
0
        public async Task <EventsRootObject> GetEvents(int skip)
        {
            var events = new EventsRootObject();

            events.Metadata = new Meta();
            events.Events   = new List <Event> ();

            for (int i = 0; i < 10; i++)
            {
                events.Events.Add(new Event {
                    Name = "This is the name of an event " + i,
                    Time = DateTime.Now.Ticks,
                    Id   = i.ToString()
                });
            }

            return(events);
        }
예제 #5
0
        public SearchForm(string userMail)
        {
            this.userMail = userMail;
            InitializeComponent();
            Opacity = 0;
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Tick += new EventHandler((sender, e) =>
            {
                if ((Opacity += 0.08d) == 1)
                {
                    timer.Stop();
                }
            });
            timer.Interval = 10;
            timer.Start();

            this.StartPosition  = FormStartPosition.CenterScreen;
            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.MouseDown += SearchForm_MouseDown;

            rootObject       = new RootObject();
            eventsRootObject = new EventsRootObject();

            CollapseButton.BackgroundImage = ProjectResources.UnfocussedCollapseButton;
            CollapseButton.MouseEnter     += CollapseButton_MouseEnter;
            CollapseButton.MouseLeave     += CollapseButton_MouseLeave;

            CloseButton.BackgroundImage = ProjectResources.UnfocussedCloseButton;
            CloseButton.MouseEnter     += CloseButton_MouseEnter;
            CloseButton.MouseLeave     += CloseButton_MouseLeave;

            ExpandButton.BackgroundImage = ProjectResources.UnfocussedButton;
            ExpandButton.MouseEnter     += ExpandButton_MouseEnter;
            ExpandButton.MouseLeave     += ExpandButton_MouseLeave;
            toolStrip1.MouseDown        += ToolStrip1_MouseDown;

            SearchTextBox.KeyDown += SearchTextBox_KeyDown;

            CityTextBox.KeyDown  += CityTextBox_KeyDown;
            CityTextBox.KeyPress += KeyPressHandler;

            Wrap.Left       = 0;
            Wrap.Top        = toolStrip1.Top + toolStrip1.Height;
            Wrap.AutoScroll = false;
            Wrap.HorizontalScroll.Enabled = false;
            Wrap.HorizontalScroll.Visible = false;
            Wrap.HorizontalScroll.Maximum = 0;
            Wrap.AutoScroll = true;

            SideBar.Parent = this;
            SideBar.BringToFront();
            SideBar.Top = toolStrip1.Height + 15;

            SearchResultsList.MouseWheel += SearchResultsList_MouseWheel;
            SearchResultsList.KeyPress   += SearchResultsList_KeyPress;
            SearchResultsList.GotFocus   += SearchResultsList_GotFocus;
            SearchResultsList.Font        = new Font("Sylfaen", 10, FontStyle.Regular);
            SearchResultsList.Left        = Wrap.Width / 2 - SearchResultsList.Width / 2;
            SearchResultsList.BorderStyle = BorderStyle.None;
            SearchResultsList.Top         = 0;

            inthernetChecker = new Thread(InthernetChecker);
            inthernetChecker.Start();

            preloader = new Preloader(ClientSize, this);

            internetErrorPictureBox.Parent = this;
            internetErrorPictureBox.Left   = Wrap.Left;
            internetErrorPictureBox.Top    = Wrap.Top;
            internetErrorPictureBox.Width  = Wrap.Width;
            internetErrorPictureBox.Height = Wrap.Height;
            internetErrorPictureBox.BackgroundImageLayout = ImageLayout.Center;
            internetErrorPictureBox.BackgroundImage       = ProjectResources.InternetErrorImage;
            internetErrorPictureBox.Visible = false;

            StartDate.MinDate = DateTime.Now;
            EndDate.MinDate   = DateTime.Now.AddDays(1);

            StartDate.ValueChanged += DateValueChanged;
            EndDate.ValueChanged   += DateValueChanged;
            Noggin.Left             = 0 - Noggin.Width;
            Noggin.Top              = ClientSize.Height - Noggin.Height;
        }
예제 #6
0
 public EventsResultDeserializer(string fileNameWithoutExtension)
 {
     _fileName         = $"{fileNameWithoutExtension}.json";
     _eventsRootObject = new EventsRootObject();
 }