public WhatsNewDialog(Context context, AppPrefs prefs, AppVersion oldVersion, AppVersion currentVersion)
 {
     this.context        = context;
     this.prefs          = prefs;
     this.oldVersion     = oldVersion;
     this.currentVersion = currentVersion;
     this.handler        = new Handler(Looper.MainLooper);
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            cache = new BitmapCache(Resources);
            prefs = AppPrefs.Get(this);
            prefs.prefs.RegisterOnSharedPreferenceChangeListener(this);

            BindService(new Intent(this, typeof(AppService)), this, 0);
        }
 private void cbSortType_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     AppPrefs.SetInt("cbSortType", cbSortType.SelectedIndex);
     if (m_current != null)
     {
         m_current.Sort((SortType)cbSortType.SelectedValue);
         List <DirItem> list = new List <DirItem>();
         list.Add(m_current);
         tvDirTree.ItemsSource = list;
     }
 }
        public void InitConfig()
        {
            AppPrefs.Init("./AppConfig.json");
            cbBaseDir.Text = AppPrefs.GetString("cbBaseDir", "");

            List <SortType> listTypes = new List <SortType>();

            listTypes.Add(SortType.从大到小);
            listTypes.Add(SortType.从小到大);

            cbSortType.ItemsSource = listTypes;

            cbSortType.SelectedIndex = AppPrefs.GetInt("cbSortType", 0);
        }
        public void InitDebuger()
        {
            Debuger.Init(AppDomain.CurrentDomain.BaseDirectory + "/Log/", new SystemColorConsole());
            Debuger.EnableLog = AppPrefs.GetInt("EnableLog", 1) > 0;
#if DEBUG
            Debuger.EnableLog = true;
#endif
            Debuger.EnableDate       = true;
            Debuger.EnableLogVerbose = false;
            Debuger.EnableSave       = true;
            Debuger.EnableErrorStack = false;
            Debuger.LogWarning("AppDomain:{0}", AppDomain.CurrentDomain.FriendlyName);
            Debuger.LogWarning("WorkDir:{0}", Directory.GetCurrentDirectory());
        }
Beispiel #6
0
        public static AppPrefs OnSave(this AppPrefs prefs)
        {
            if (prefs == null)
            {
                return(null);
            }

            if (prefs.Query != null)
            {
                var keysToRemove = new List <string>();
                foreach (var entry in prefs.Query)
                {
                    if (entry.Value.IsEmpty())
                    {
                        keysToRemove.Add(entry.Key);
                    }
                }
                keysToRemove.Each(x => prefs.Query.Remove(x));
            }

            return(prefs);
        }
        private void btnCalc_Click(object sender, RoutedEventArgs e)
        {
            var dirPath = cbBaseDir.Text;

            if (!Directory.Exists(dirPath))
            {
                Debuger.LogError("目录不存在:{0}", dirPath);
                return;
            }

            AppPrefs.SetString("cbBaseDir", cbBaseDir.Text);
            AppPrefs.Save();

            m_current = new DirItem(new DirectoryInfo(dirPath));
            m_current.CalcSize();
            m_current.Sort((SortType)cbSortType.SelectedValue);

            List <DirItem> list = new List <DirItem>();

            list.Add(m_current);
            tvDirTree.ItemsSource = list;
        }