コード例 #1
0
        private void CreateImageClick(object sender, RoutedEventArgs e)
        {
            string protectionLevel;

            if ((bool)PrivateProtectionLevel.IsChecked)
            {
                protectionLevel = "private";
            }
            else
            {
                if (ImagePassword.Password.Length > 0)
                {
                    protectionLevel = "protected";
                }
                else
                {
                    protectionLevel = "public";
                }
            }

            Image newImage = new Image
            {
                title           = ImageTitle.Text,
                ownerId         = ServerService.instance.isOffline() ? null : ServerService.instance.user.id,
                id              = ServerService.instance.isOffline() ? Guid.NewGuid().ToString() : null,
                password        = ImagePassword.Password,
                protectionLevel = protectionLevel
            };

            ImageDao.Post(newImage);
        }