예제 #1
0
        // Generate button -> creating new LoaderForm starts generating
        private void ButtonGenerate_Click(object sender, EventArgs e)
        {
            // checks if friend info is to be redownloaded == deletes the data file
            if(CheckBoxFriendInfo.Checked) {
                if(File.Exists("cache/" + Config.USER_ID + "/data.json"))
                    try {
                        File.Delete("cache/" + Config.USER_ID + "/data.json");
                    } catch {
                        MessageBox.Show("Couldn't delete friend info data. File is opened or inaccessible and generating the graph might now work well.");
                    }
            }

            // checks if friend photos are to be redownloaded == deletes the photos/ files
            if(CheckBoxPhotos.Checked) {
                string path = "cache/" + Config.USER_ID + "/photos";

                if(Directory.Exists(path)) {
                    foreach(string file in Directory.GetFiles(path)) {
                        try {
                            File.Delete("cache/" + Config.USER_ID + "/photos/" + file);
                        } catch {}
                    }
                }
            }

            LoaderForm lf = new LoaderForm();
            lf.ShowDialog(this);

            if(File.Exists("cache/" + Config.USER_ID + "/graph.jpg")) {
                ButtonShowLast.Enabled = true;
            }
        }
예제 #2
0
        // Generate button -> creating new LoaderForm starts generating
        private void ButtonGenerate_Click(object sender, EventArgs e)
        {
            // checks if friend info is to be redownloaded == deletes the data file
            if (CheckBoxFriendInfo.Checked)
            {
                if (File.Exists("cache/" + Config.USER_ID + "/data.json"))
                {
                    try {
                        File.Delete("cache/" + Config.USER_ID + "/data.json");
                    } catch {
                        MessageBox.Show("Couldn't delete friend info data. File is opened or inaccessible and generating the graph might now work well.");
                    }
                }
            }

            // checks if friend photos are to be redownloaded == deletes the photos/ files
            if (CheckBoxPhotos.Checked)
            {
                string path = "cache/" + Config.USER_ID + "/photos";

                if (Directory.Exists(path))
                {
                    foreach (string file in Directory.GetFiles(path))
                    {
                        try {
                            File.Delete("cache/" + Config.USER_ID + "/photos/" + file);
                        } catch {}
                    }
                }
            }

            LoaderForm lf = new LoaderForm();

            lf.ShowDialog(this);

            if (File.Exists("cache/" + Config.USER_ID + "/graph.jpg"))
            {
                ButtonShowLast.Enabled = true;
            }
        }