Exemplo n.º 1
0
        public void FillGrid()
        {
            _list.ListView.Clear();

            string[] contents = File.ReadAllLines(FilePath);

            foreach (string line in contents)
            {
                string[] temp = line.Split('-'); //temp should always have only two strings contained after this point, the ID and the Name

                IngredientItem G = new IngredientItem(new Ingredient(Convert.ToInt32(temp[0]), temp[1], ""), 0.0f, Measurements.Serving);
                _list.Add(G);
            }
        }
Exemplo n.º 2
0
        public Page1()
        {
            InitializeComponent();

            // ログイン情報の復元 (今回はトークンいらないので ID 表示情報だけ保存するずるい方式)
            if (Application.Current.Properties.ContainsKey("MyInfo"))
            {
                try
                {
                    string json = Application.Current.Properties["MyInfo"] as string;
                    m_myInfo = JsonConvert.DeserializeObject <UserViewModel>(json);
                }
                catch (Exception)
                {
                }
            }
            if (m_myInfo == null)
            {
                m_myInfo = new UserViewModel {
                    Id = "", DisplayName = "unknown", Image = "nologin.png"
                };
            }
            MyUserLayout.BindingContext = m_myInfo;

            // Make data list
            m_list = new ListViewModel();
            m_list.Add(
                new TimelineItem
            {
                ArticleName = "",
                ArticleUrl  = "",
                Comment     = new HatenaComment
                {
                    UserId  = "",
                    Comment = "画面右上のメニューからログインしてください",
                    Date    = "",
                }
            }
                );


            // Bind
            //this.BindingContext = m_list;
            MyListFrame.BindingContext = m_list;
            //MyList.ItemsSource = m_list.MyListData;

            // 右上メニュー画像タップ
            var tapRecognizer = new TapGestureRecognizer
            {
                Command = new Command(async() => {
                    await OnMenuIconClicked();
                }),
                NumberOfTapsRequired = 1
            };

            MenuIcon.GestureRecognizers.Add(tapRecognizer);

            // リストビュータップ
            MyList.ItemTapped += OnItemTapped;
        }
Exemplo n.º 3
0
 /// <summary>
 ///		Inicializa las propiedades
 /// </summary>
 private void InitProperties()
 {
     // Inicializa la colección
     FilesDefinition = new ListViewModel <ListItems.FileDefinitionListItemViewModel>();
     // Añade las definiciones
     foreach (AbstractDefinitionModel definition in _project.Definition.FilesDefinition)
     {
         if (definition is FileDefinitionModel)
         {
             FilesDefinition.Add(new ListItems.FileDefinitionListItemViewModel(definition as FileDefinitionModel));
         }
     }
 }
Exemplo n.º 4
0
        private void DoSearch()
        {
            _list.ListView.Clear();

            IRecipeAPI api = SpoonacularAPI.SpoonacularAPI.GetInstance();

            List <Recipe_Short> list = api.RecipeSearch(Recipe_Search.Text, _recipesPerPage, _offset);

            foreach (Recipe_Short r in  list)
            {
                _list.Add(r);
            }
        }
Exemplo n.º 5
0
        async public void FillGrid()
        {
            string ConnectionString = SqlHelper.GetConnectionString();
            //Below querys assumes that UserIDs and PantryIDs are equivalent
            //Commented query below will be used when more columns are added to INGREDIENT
            //string query = String.Format("SELECT ING.IngredientID, ING.CommonName, ING.LongDesc, Quantity FROM PANTRY_INGREDIENTS AS PING JOIN INGREDIENT AS ING ON PING.IngredientID = ING.IngredientID WHERE PantryID = {0};", SqlHelper.UserID);
            string query = String.Format("SELECT IngredientID, CommonName, Quantity FROM PANTRY_INGREDIENTS WHERE PantryID={0};", SqlHelper.UserID);

            SqlConnection con  = new SqlConnection(ConnectionString);
            SqlCommand    comm = new SqlCommand(query, con);

            try
            {
                con.Open();
            }
            catch (Exception)
            {
                await DisplayAlert("Failed", "Could not connect", "OK");
            }

            try
            {
                SqlDataReader read = comm.ExecuteReader();

                while (read.Read())
                {
                    IngredientItem p = new IngredientItem(new Ingredient(read.GetInt32(0), read.GetString(1), ""), read.GetInt32(2), Measurements.Serving);
                    _list.Add(p);
                }
            }
            catch (Exception)
            {
                await DisplayAlert("Error", "Exception thrown while reading from database in FillGrid", "OK");
            }

            con.Close();
        }
 /// <summary>
 ///		Inicializa las propiedades
 /// </summary>
 private void InitProperties()
 {
     // Inicializa la colección
     ProjectsDefinition = new ListViewModel <ListItems.ProjectDefinitionListItemViewModel>();
     // Carga la colección de proyectos
     foreach (Model.Definitions.ProjectDefinitionModel project in SourceEditorViewModel.Instance.PluginsController.ProjectDefinitions)
     {
         ProjectsDefinition.Add(new ListItems.ProjectDefinitionListItemViewModel(project));
     }
     // Asigna la ruta inicial
     if (_solution == null)
     {
         PathTarget = SourceEditorViewModel.Instance.PathData;
     }
     else
     {
         PathTarget = System.IO.Path.GetDirectoryName(_solution.FullFileName);
     }
 }
Exemplo n.º 7
0
    /*
     * 保存自己的模板
     */
    public void saveModel()
    {
        string userId = "";

        if (Session[Config.Curren_User] == null)
        {
            return;
        }
        ACCTRUE.WMSBLL.Model.User user = (ACCTRUE.WMSBLL.Model.User)Session[Config.Curren_User];
        userId = user.UserID;

        string showList = ",";

        foreach (Control col in m_pnlInfo.Controls)
        {
            if (((CheckBox)col).Checked)
            {
                showList += ((CheckBox)col).ID + ",";
            }
        }
        this.hidShowList.Value = showList;
        ListViewModel listMode = ListViewModel.GetListViewModelModel(userId, m_pageNbr);

        if (listMode != null)
        {
            listMode.ShowList = showList;
            listMode.HeadFont = Convert.ToInt32(drpHeadFont.SelectedValue);
            listMode.ListFont = Convert.ToInt32(drpListFont.SelectedValue);
            listMode.Update();
            return;
        }
        listMode          = new ListViewModel();
        listMode.PageNbr  = m_pageNbr;
        listMode.ShowList = showList;
        listMode.HeadFont = Convert.ToInt32(drpHeadFont.SelectedValue);
        listMode.ListFont = Convert.ToInt32(drpListFont.SelectedValue);
        listMode.UserID   = userId;
        listMode.Add();
    }