Ejemplo n.º 1
0
        public static int InitItems()
        {
            FileOps.UserDataCollection userData = Utility.userData;
            if (userData != null && userData.userData != null && userData.userData.Count > 0)
            {
                foreach (UserData ud in userData.userData)
                {
                    switch (ud.DataType)
                    {
                    case "file":
                        if (_FileItems.Where(c => c.Data == ud.Data).ToArray().Length == 0)
                        {
                            App.Current.Dispatcher.Invoke((Action) delegate
                            {
                                _FileItems.Add(ud);
                            });
                        }
                        break;

                    case "folder":
                        if (_FolderItems.Where(c => c.Data == ud.Data).ToArray().Length == 0)
                        {
                            App.Current.Dispatcher.Invoke((Action) delegate
                            {
                                _FolderItems.Add(ud);
                            });
                        }
                        break;

                    case "text":
                        if (_TextItems.Where(c => c.Data == ud.Data).ToArray().Length == 0)
                        {
                            App.Current.Dispatcher.Invoke((Action) delegate
                            {
                                _TextItems.Add(ud);
                            });
                        }
                        break;

                    default: break;
                    }
                }

                //worker.ReportProgress(90,
                //Dispatcher.BeginInvoke(

                //)
                //);
            }
            return(0);
        }
Ejemplo n.º 2
0
 public static void AddData(UserData userdata)
 {
     try
     {
         if (userData == null)
         {
             userData = new FileOps.UserDataCollection();
         }
         UserData[] ud = userData.userData.Where(c => c.Data.ToString().Trim().Equals(userdata.Data.ToString().Trim()) && c.DataType.Trim().Equals(userdata.DataType.Trim())).ToArray();
         if (ud.Length <= 0 && userdata.Data.ToString().Trim().Length > 0)
         {
             userData.userData.Add(userdata);
         }
     }
     catch (Exception) { }
 }