コード例 #1
0
ファイル: CategoryList.cs プロジェクト: rabihsyw/Easyshare
        private Category buildCategoryObject(SQLiteDataReader data)
        {
            Category newCat = new Category();
            newCat.name = data["category_name"].ToString();
            newCat.id = Convert.ToInt32(data["category_id"]);
            newCat.owner_id = Convert.ToInt32(data["owner_id"]);

            return newCat;
        }
コード例 #2
0
ファイル: Categories.xaml.cs プロジェクト: rabihsyw/Easyshare
        private Button createCategoryButton(Category iCat)
        {
            int random = getrandom.Next(0, 5);
            List<string> colours = new List<string>();
            colours.Add("#D2691E");
            colours.Add("#da542e");
            colours.Add("#92009c");
            colours.Add("#029801");
            colours.Add("#2396A6");
            colours.Add("#593D91");
            // main image contain
            
            StackPanel dock = new StackPanel();
            dock.Orientation = Orientation.Vertical;
            dock.Height = 100;
            dock.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;

            /// creating image
            Image img = new Image();
            img.Width = 40;
            img.Height = 40;
            img.Source = new BitmapImage(new Uri(@"../Resources/folder.png", UriKind.Relative));
            dock.Children.Add(img);
            
            Label lb = new Label();
            lb.Content = iCat.name.ToString() + "\n" + "Files(" + iCat.getFileCount().ToString() + ")";
            dock.Children.Add(lb);

            var x = new Button();
            //x.Title = iCat.name.ToString();
            x.Content = dock;
            //x.Count = iCat.getFileCount().ToString();
            //x.CountFontSize = 10;

            x.Tag = iCat.id;
            //x.Background = new SolidColorBrush((Color)(ColorConverter.ConvertFromString(colours[random])));
            x.Background = null;
            x.BorderThickness = new Thickness(0);
            x.Click += this.selectCategory;
            x.MouseDoubleClick += this.clickCategory;

            x.Height = 100;
            x.Width = 140;
            //x.TitleFontSize = 13;
            x.FontSize = 11;
            x.Margin = new Thickness(5);
            x.Padding = new Thickness(2);

            return x;
        }
コード例 #3
0
ファイル: CategoryList.cs プロジェクト: rabihsyw/Easyshare
        public Category searchByName(String name)
        {
            Category newCat = new Category();

            string qu1 = string.Format(@"select * from category where owner_id = '{0}' and category_name = '{1}';", Owner.SessionOwnerId, name);
            SQLiteDataReader data = db.selectQuery(qu1);
            if (data.Read())
            {
                newCat = buildCategoryObject(data);
            }
            data.Close();
            return newCat;

        }
コード例 #4
0
ファイル: CategoryList.cs プロジェクト: rabihsyw/Easyshare
        public IEnumerable<Category> searchCategories()
        {
            this.Category = new List<Category>();

            string qu1 = string.Format(@"select * from category where owner_id like '{0}';", Owner.SessionOwnerId);
            SQLiteDataReader data = db.selectQuery(qu1);
            while (data.Read())
            {
                Category newCat = new Category();
                newCat.name = data["category_name"].ToString();
                newCat.id   = Convert.ToInt32(data["category_id"]);
                newCat.owner_id = Convert.ToInt32(data["owner_id"]);

                this.Category.Add(newCat);

            }
            IEnumerable<Category> d = (IEnumerable<Category>)this.Category;
            data.Close();
            return d;
            
        }
コード例 #5
0
ファイル: MainWindow.xaml.cs プロジェクト: rabihsyw/Easyshare
 private void getFilesFromService(Category c)
 {
     Nemiro.OAuth.OAuthUtility.ExecuteRequestAsync
     (
       "GET",
       "https://api.dropbox.com/1/metadata/auto/"+c.name,
       new HttpParameterCollection
       {
         { "access_token", Properties.Settings.Default.AccessToken }
       }, null, null, null, Properties.Settings.Default.AccessToken,
       callback: getFilesFromServiceCallback
     );
 }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: rabihsyw/Easyshare
        private void getCategoriesFromServiceCallback(RequestResult result)
        {
            CategoryList catList = new CategoryList();
            if (result.StatusCode == 200)
            {
                foreach (UniValue value in result["contents"])
                {
                    String folderName = value["path"].ToString().Replace("/", "");

                    if ((Boolean)value["is_dir"] == true && !catList.isInserted(folderName))
                    {
                        Category c = new Category();
                        c.name = folderName;
                        c.owner_id = Easyshare.Classes.Owner.SessionOwnerId;
                        c.sync = true;
                        c.insert();
                        this.getFilesFromService(c);
                    }
                    
                }
                /*
                String userName = result["display_name"].ToString();
                String userEmail = result["email"].ToString();
                this.Dispatcher.Invoke((Action)(() =>
                {
                    this.user_email_text.Text = userEmail;
                    RegisterEventHandler(this.registerButton, null);
                }));
                */
                // show a list of files 

            }
        }
コード例 #7
0
ファイル: CategoryList.cs プロジェクト: rabihsyw/Easyshare
        public Category getById(int id)
        {
            Category newCat = new Category();

            string qu1 = string.Format(@"select * from category where category_id = '{0}';", id);
            SQLiteDataReader data = db.selectQuery(qu1);
            if (data.Read())
            {
                newCat = buildCategoryObject(data);
            }
            data.Close();
            return newCat;

        }