예제 #1
0
        private async Task AddTarget()
        {
            UserIcon target        = new UserIcon();
            int      disappearTime = R.Next(600, 5000);
            bool     removed       = false;

            target.Content     = disappearTime;
            target.Height      = R.Next(30, 120);
            target.ImageSource = new BitmapImage(new Uri("/Assets/Target.png", UriKind.Relative));
            target.Style       = this.FindResource("Menu") as Style;
            Canvas.SetLeft(target, R.Next(40, 978));
            Canvas.SetTop(target, R.Next(40, 404));
            Playground.Children.Add(target);
            TargetCount++;
            target.Click += (source, e) =>
            {
                UpdateMoney(1000);
                Playground.Children.Remove(target);
                TargetCount--;
                ClickedCount++;
                UpdateClicks();
                removed = true;
            };
            await Task.Delay(disappearTime);

            if (removed == false && Score > 0)
            {
                UpdateMoney(-1500);
                Playground.Children.Remove(target);
                TargetCount--;
            }
        }
예제 #2
0
        public override void AddUser()
        {
            var userIcon = new UserIcon();

            var markerOptions = userIcon.MarkerOptions;

            markerOptions.SetPosition(new LatLng(Settings.UserLatitude, Settings.UserLongitude));

            _userMarker = _nativeMap.AddMarker(markerOptions);
        }
예제 #3
0
파일: UserList.cs 프로젝트: locelus/Risk
    public void NewUserCreated(User user)
    {
        GameObject temp = Instantiate(userIcon);

        temp.transform.position = new Vector3(temp.transform.position.x, ((GameManager.instance.users.Count * -50) + 50));
        temp.transform.SetParent(content, false);
        temp.transform.rotation = Quaternion.identity;
        UserIcon codeIcon = temp.GetComponent <UserIcon>();

        codeIcon.NewUser(user);
    }
        public override void AddUser()
        {
            var geoposition = new Models.Geoposition
            {
                Latitude  = Settings.UserLatitude,
                Longitude = Settings.UserLongitude
            };

            var userIcon = new UserIcon();

            _mapItems.Items.Add(userIcon);
            SetMapIconPosition(userIcon, geoposition, new Point(0.5, 0.5));
        }
예제 #5
0
 private void RefreshUsersList()
 {
     WpUserIconContainer.Children.Clear();
     foreach (var i in SaveLoader.Save.Profiles)
     {
         UserIcon newUser = new UserIcon();
         newUser.Content     = i.Name;
         newUser.Style       = FindResource("UserIconStyle") as Style;
         newUser.ImageSource = new BitmapImage(new Uri("/Assets/User.png", UriKind.Relative));
         newUser.Click      += new RoutedEventHandler(UserIcon_Click);
         WpUserIconContainer.Children.Add(newUser);
     }
 }
        void airServer_UserReceiveFilesComplete(AirFileExchange.Air.SendFiles sendFiles, AirServer.IPEndPointHolder remotePoint,
                                                object state, Exception e)
        {
            if (Dispatcher.Thread != Thread.CurrentThread)
            {
                Dispatcher.BeginInvoke(new AirServer.UserReceiveFilesComplete(airServer_UserReceiveFilesComplete), new object[] { sendFiles, remotePoint, state, e });
                return;
            }

            UserIcon userIcon = (UserIcon)state;

            userIcon.ProgressValue = 0;
            userIcon.LastStatus    = e == null ? UserIcon.OperationStatus.Success : UserIcon.OperationStatus.Failed;
        }
        void airServer_UserReceiveFilesProgress(AirFileExchange.Air.SendFile sendFile, AirServer.IPEndPointHolder remotePoint,
                                                long receivedCurrent, long currentSize, long receivedTotal, long totalSize, object state, out bool cancel)
        {
            UserIcon userIcon = (UserIcon)state;

            cancel = isClosed || userIcon.IsCanceled;

            if (Dispatcher.Thread != Thread.CurrentThread)
            {
                Dispatcher.BeginInvoke(new AirServer.UserReceiveFilesProgress(airServer_UserReceiveFilesProgress), new object[] { sendFile, remotePoint,
                                                                                                                                  receivedCurrent, currentSize, receivedTotal, totalSize, state, cancel });
                return;
            }

            userIcon.ProgressValue = 10000 * receivedTotal / totalSize;
        }
        void userIcon_DropFileList(object sender, string[] fileDropList)
        {
            UserIcon userIcon = (UserIcon)sender;

            if (userIcon.IsSuspend || userIcon.ProgressValue != 0)
            {
                return;
            }

            userIcon.IsCanceled = false;
            userIcon.IsSuspend  = true;
            userIcon.LastStatus = UserIcon.OperationStatus.None;

            airClient.SendFilesToAsync(userIcon.RemotePoint.IpEndPoint, fileDropList,
                                       new AirClient.SendFilesProgress(airClient_SendFilesProgress),
                                       userIcon, new AirClient.SendFilesComplete(airClient_SendFilesTo));
        }
        void airClient_SendFilesProgress(string file, IPAddress ipAddress, long sentCurrent, long currentSize,
                                         long sentTotal, long totalSize, object state, out bool cancel)
        {
            UserIcon userIcon = (UserIcon)state;

            cancel = isClosed || userIcon.IsCanceled;


            if (Dispatcher.Thread != Thread.CurrentThread)
            {
                Dispatcher.BeginInvoke(new AirClient.SendFilesProgress(airClient_SendFilesProgress), new object[] { file, ipAddress,
                                                                                                                    sentCurrent, currentSize, sentTotal, totalSize, state, cancel });
                return;
            }

            userIcon.IsSuspend     = false;
            userIcon.ProgressValue = 10000 * sentTotal / totalSize;
        }
        public SettingsPageViewModel(INavigationService navigationService) : base(navigationService)
        {
            Title = "Settings";

            IsVisibleUserIcon = UserIcon.Select(x => x != null)
                                .ToReactiveProperty();

            StartingAuthCommand.Subscribe(async _ =>
            {
                TwitterUser.Session = await OAuth.AuthorizeAsync(TwitterUser.APIKey, TwitterUser.APISecret);
                Process.Start(TwitterUser.Session.AuthorizeUri.AbsoluteUri);
            });

            UserAuthCommand.Subscribe(async _ =>
            {
                try
                {
                    TwitterUser.Tokens = await TwitterUser.Session.GetTokensAsync(PinCode.Value);

                    if (TwitterUser.Tokens.Account.VerifyCredentialsAsync() != null)
                    {
                        var response = await TwitterUser.Tokens.Account.VerifyCredentialsAsync();

                        userIcon.Value          = ImageSource.FromUri(new Uri(response.ProfileImageUrl));
                        IsVisibleUserIcon.Value = true;

                        var builder = new StringBuilder();
                        builder.AppendLine($"UserName : { response.Name }");
                        builder.Append($"UserID : @{ response.ScreenName }");
                        userInfo.Value = builder.ToString();
                    }
                    else
                    {
                        App.Logger.Warn("ログイン認証失敗");
                    }
                }
                catch (Exception ex)
                {
                    App.Logger.Error(ex.Message + Environment.NewLine + ex.StackTrace);
                }
            });
        }
        void airClient_SendFilesTo(object state, Exception e)
        {
            if (Dispatcher.Thread != Thread.CurrentThread)
            {
                Dispatcher.BeginInvoke(new AirClient.SendFilesComplete(airClient_SendFilesTo), new object[] { state, e });
                return;
            }

            UserIcon userIcon = (UserIcon)state;

            userIcon.IsSuspend     = false;
            userIcon.ProgressValue = 0;
            userIcon.LastStatus    = e == null ? UserIcon.OperationStatus.Success : UserIcon.OperationStatus.Failed;

            if (e is AirClient.AirDeniedException)
            {
                MessageBox.Show(this, string.Format("\"{0}\" denied your request to send the files.", userIcon.TextDisplayName.Text),
                                "AirFileExchange - Receiving files denied");
            }
        }
        void userIcon_Click(object sender, EventArgs e)
        {
            UserIcon userIcon = (UserIcon)sender;

            if (userIcon.IsSuspend)
            {
                return;
            }

            if (userIcon.ProgressValue != 0)
            {
                if (MessageBox.Show(this, "Do you want to cancel the operation?", "AirFileExchange",
                                    MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    userIcon.IsCanceled = true;
                }
                return;
            }

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter      = "All Files (*.*)|*.*";
            openFileDialog.Multiselect = true;
            openFileDialog.Title       = string.Format("AirFileExchange - Share files with \"{0}\"", userIcon.TextDisplayName.Text);

            if (openFileDialog.ShowDialog(this) ?? true)
            {
                userIcon.IsCanceled = false;
                userIcon.IsSuspend  = true;
                userIcon.LastStatus = UserIcon.OperationStatus.None;

                airClient.SendFilesToAsync(userIcon.RemotePoint.IpEndPoint, openFileDialog.FileNames,
                                           new AirClient.SendFilesProgress(airClient_SendFilesProgress),
                                           userIcon, new AirClient.SendFilesComplete(airClient_SendFilesTo));
            }
            else
            {
                userIcon.ProgressValue = 0;
            }
        }
        void airServer_UserPresenceReceivedRequest(Air.RequestPresence request, AirServer.IPEndPointHolder remotePoint)
        {
            if (Dispatcher.Thread != Thread.CurrentThread)
            {
                Dispatcher.BeginInvoke(new AirServer.UserPresenceRequest(airServer_UserPresenceReceivedRequest), new object[] { request, remotePoint });
                return;
            }

            if (!remotePoint.IsMine)
            {
                UserIcon userIcon = new UserIcon();
                userIcon.RemotePoint           = remotePoint;
                userIcon.TextDisplayName.Text  = request.UserInfo.DisplayName;
                userIcon.TextComputerName.Text = request.UserInfo.ComputerName;
                userIcon.ImageIcon.Source      = AirFileExchange.Air.Helper.ImageFromBase64(request.UserInfo.Icon);
                userIcon.Click        += new EventHandler(userIcon_Click);
                userIcon.DropFileList += new UserIcon.EventDropFileList(userIcon_DropFileList);
                PanelOfUsers.Children.Add(userIcon);

                userIcon.Popup();
            }
        }
예제 #14
0
        public void Draw(string SpriteName)
        {
            Console.SetCursorPosition(0, 11);
            switch (SpriteName)
            {
            case "25":
                Thread thr0 = new Thread(new ParameterizedThreadStart(DrawAddSprite));
                thr0.Start(Add25);
                break;

            case "100":
                Thread thr1 = new Thread(new ParameterizedThreadStart(DrawAddSprite));
                thr1.Start(Add100);
                break;

            case "ProgressBar":
                Console.SetCursorPosition(0, 11);
                for (int i = 0; i < ProgressBarSprite.GetLength(0); i++)
                {
                    Console.SetCursorPosition(51, (17 + i));
                    Console.Write(ProgressBarSprite[i]);
                }
                break;

            case "UserIcon":
                for (int c = 0; c < 4; c++)
                {
                    for (int i = 0; i < UserIcon.GetLength(0); i++)
                    {
                        Console.SetCursorPosition((3 + (c * 8)), (25 + i));
                        Console.Write(UserIcon[i]);
                    }
                }
                break;
            }
        }
예제 #15
0
 private async void Button_Clicked(object sender, EventArgs e)
 {
     await UserIcon.TranslateTo(0, 200, 2000, Easing.BounceIn);
 }
예제 #16
0
 /// <summary>
 /// Required method for Designer support - do not modify 
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DecimalUpDown));
     this.txtValue = new System.Windows.Forms.TextBox();
     this.picUp = new UserIcon();
     this.picDown = new UserIcon();
     this.tmrUpDown = new System.Windows.Forms.Timer();
     this.SuspendLayout();
     //
     // txtValue
     //
     this.txtValue.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                 | System.Windows.Forms.AnchorStyles.Left)
                 | System.Windows.Forms.AnchorStyles.Right)));
     this.txtValue.Location = new System.Drawing.Point(0, 0);
     this.txtValue.MaxLength = 12;
     this.txtValue.Name = "txtValue";
     this.txtValue.Size = new System.Drawing.Size(56, 22);
     this.txtValue.TabIndex = 0;
     this.txtValue.Text = "0.00";
     this.txtValue.LostFocus += new System.EventHandler(this.Control_ChangeFocus);
     this.txtValue.GotFocus += new System.EventHandler(this.Control_ChangeFocus);
     this.txtValue.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtValue_KeyPress);
     this.txtValue.Validating += new System.ComponentModel.CancelEventHandler(this.txtValue_Validating);
     this.txtValue.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtValue_KeyDown);
     //
     // picUp
     //
     this.picUp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                 | System.Windows.Forms.AnchorStyles.Right)));
     this.picUp.Location = new System.Drawing.Point(56, 0);
     this.picUp.Name = "picUp";
     this.picUp.Tag = "UP";
     this.picUp.Click += new System.EventHandler(this.UpDown_Click);
     this.picUp.MouseDown += new System.Windows.Forms.MouseEventHandler(this.UpDown_MouseDown);
     this.picUp.MouseUp += new System.Windows.Forms.MouseEventHandler(this.UpDown_MouseUp);
     this.picUp.Size = new System.Drawing.Size(14, 22);
     this.picUp.Type = UserIcon.IconType.UpArrow;
     //
     // picDown
     //
     this.picDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                 | System.Windows.Forms.AnchorStyles.Right)));
     this.picDown.BackColor = System.Drawing.Color.Black;
     this.picDown.Location = new System.Drawing.Point(70, 0);
     this.picDown.Name = "picDown";
     this.picDown.Size = new System.Drawing.Size(14, 22);
     this.picDown.Tag = "DOWN";
     this.picDown.Click += new System.EventHandler(this.UpDown_Click);
     this.picDown.MouseDown += new System.Windows.Forms.MouseEventHandler(this.UpDown_MouseDown);
     this.picDown.MouseUp += new System.Windows.Forms.MouseEventHandler(this.UpDown_MouseUp);
     this.picDown.Type = UserIcon.IconType.DownArrow;
     //
     // tmrUpDown
     //
     this.tmrUpDown.Interval = 500;
     this.tmrUpDown.Tick += new System.EventHandler(this.tmrUpDown_Tick);
     //
     // DecimalUpDown
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(84F, 22F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
     this.BackColor = System.Drawing.Color.Black;
     this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
     this.Controls.Add(this.txtValue);
     this.Controls.Add(this.picDown);
     this.Controls.Add(this.picUp);
     this.Name = "DecimalUpDown";
     this.Size = new System.Drawing.Size(82, 21);
     this.Resize += new System.EventHandler(this.UpDown_Resize);
     this.ResumeLayout(false);
 }