Esempio n. 1
0
        public FileLabel(string path)
        {
            this.FilePath = path;
            InitializeComponent();
            onCloseFile     += new CloseEvent(() => { });
            onClosedFile    += new ClosedEvent(() => { });
            onProgressBegin += new ProgressBeginEvent(() => { });
            onProgressEnd   += new ProgressEndEvent(() => { });
            onAccept        += new AcceptEvent(() => { });

            this.fileName.Content = filePath.Substring(filePath.LastIndexOf("\\") + 1);
            this.Progress.Maximum = 100;

            ImageBrush imgB = new ImageBrush(System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Close1.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()));

            this.btnClose.Background      = imgB;
            this.btnClose.BorderThickness = new Thickness(1);
            this.btnClose.Click          += new RoutedEventHandler((object obj, RoutedEventArgs e) =>
            {
                this.Close();
            });

            this.acceptLabel.MouseLeftButtonUp += new MouseButtonEventHandler((object obj1, MouseButtonEventArgs e1) =>
            {
                this.ProgresBegin();
                this.HiddenAccept();
            });
        }
Esempio n. 2
0
        public void Tick()
        {
            // 处理 accept 事件
            while (m_AcceptEventCount > 0)
            {
                AcceptEvent e = null;
                lock (m_AcceptEventList)
                {
                    e = m_AcceptEventList[0];
                    m_AcceptEventList.RemoveAt(0);
                    m_AcceptEventCount--;
                }
                onAccept.Invoke(e.cfd);
            }

            // 处理 receive 事件
            while (m_DataCount > 0)
            {
                Data msg = null;
                lock (m_DataList)
                {
                    msg = m_DataList[0];
                    m_DataList.RemoveAt(0);
                    m_DataCount--;
                }
                onReceive.Invoke(msg.clientfd, msg.byteData);
            }

            m_CloseEvents.InvokeEvent();
        }
Esempio n. 3
0
        public FileLabel(string path)
        {
            this.FilePath = path;
            InitializeComponent();
            onCloseFile += new CloseEvent(() => { });
            onClosedFile += new ClosedEvent(() => { });
            onProgressBegin += new ProgressBeginEvent(() => { });
            onProgressEnd += new ProgressEndEvent(() => { });
            onAccept += new AcceptEvent(() => { });

            this.fileName.Content = filePath.Substring(filePath.LastIndexOf("\\") + 1);
            this.Progress.Maximum = 100;

            ImageBrush imgB = new ImageBrush(System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.Close1.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()));
            this.btnClose.Background = imgB;
            this.btnClose.BorderThickness = new Thickness(1);
            this.btnClose.Click += new RoutedEventHandler((object obj, RoutedEventArgs e) =>
            {
                this.Close();
            });

            this.acceptLabel.MouseLeftButtonUp += new MouseButtonEventHandler((object obj1, MouseButtonEventArgs e1) =>
            {
                this.ProgresBegin();
                this.HiddenAccept();
            });
        }
Esempio n. 4
0
        private StringBuilder GetMessage()
        {
            string             answer = "", message = ""; bool correct = false;
            Validator <string> validator = new Validator <string>();
            AcceptEvent        first     = (variant) => message = variant == 1 ? lastMessage : Console.ReadLine();
            AcceptEvent        second    = (variant) => message = variant == 1 ? config.EncFlag + message : config.DecFlag + message;

            validator.onFail   += () => Console.Write("Invalid input. Try again: ");
            validator.onAccept += first;
            do
            {
                Console.Write("Choose what to do: load last or write new message [l/w]: ");
                answer  = Console.ReadLine();
                correct = validator.Validate(answer.ToLower(), "l", "w");
            } while (!correct);
            correct             = false;
            validator.onAccept -= first;
            validator.onAccept += second;
            do
            {
                Console.Write("Choose what to do: encrypt or decrypt [e/d]: ");
                answer  = Console.ReadLine();
                correct = validator.Validate(answer, "e", "d");
            } while (!correct);
            StringBuilder builder = new StringBuilder().Append(answer);

            return(builder);
        }
Esempio n. 5
0
 private void AcceptButtonOnclick()
 {
     AcceptEvent?.Invoke(Quest);
     if (Quest.Status != QuestStatus.NotAccepted)
     {
         ToggleVisual(false);
     }
     // visual.SetActive(false);
 }
Esempio n. 6
0
            private void OnAccept(AcceptEvent e)
            {
                Session session;

                session = server.sessionPool.Acquire();
                if(session != null)
                {
                    session.Reset(e.client);
                    session.OnConnect();
                }
                else
                    server.logger.Warn("Worker::OnAccept - sessionPool underflow");
            }