Exemple #1
0
        private void buttonRun_Click(object sender, EventArgs e)
        {
            try
            {
                wallid      = textBoxGroupId.Text;
                token       = textBoxToken.Text;
                commentText = richTextBoxComment.Text;
                dir         = textBoxFolder.Text;
                isGroup     = checkBoxIsGroup.Checked;
                deleteImage = checkBoxDelete.Checked;

                //ADD NAME AND SCREEN NAME
                if (isGroup)
                {
                    var tuple = VkApi.getById(token, wallid);
                    screenName = tuple.Item1;
                    // name = tuple.Item2;
                    name   = Win1251ToUtf8(tuple.Item2);
                    wallid = "-" + tuple.Item3;
                }
                else
                {
                    name = screenName = wallid;
                }


                //ADD TO DICT OR UPDATE THREAD
                if (wallDictKeysCopy.Contains(screenName))
                {
                    wallDict[screenName].dir         = dir;
                    wallDict[screenName].commentText = commentText;
                    wallDict[screenName].token       = token;
                    wallDict[screenName].isGroup     = isGroup;
                    wallDict[screenName].deleteImage = deleteImage;

                    makeLog(screenName + " settings updated");
                }
                else
                {
                    Wall wall = new Wall(token, dir, wallid, commentText, isGroup, name, screenName, deleteImage);

                    UploadThread currentThread = new UploadThread(this, wall);
                    wallDict.Add(screenName, currentThread);
                    wallDictKeysCopy.Add(screenName);
                    makeLog(screenName + " NEW thread started");
                    int index = listBoxRunning.FindString(screenName);
                    listBoxRunning.SetSelected(index, true);
                }
            }

            catch (VkApiException ex)
            {
                makeLog(ex.Message);
            }
            catch (Exception ex)
            {
                makeLog(ex.Message);
            }
        }
Exemple #2
0
 void addThread(Wall wall)
 {
     try
     {
         UploadThread currentThread = new UploadThread(this, wall);
         wallDict.Add(wall.screenName, currentThread);
         wallDictKeysCopy.Add(wall.screenName);
         makeLog(wall.screenName + " NEW thread started");
         int index = listBoxRunning.FindString(wall.screenName);
         listBoxRunning.SetSelected(index, true);
     }
     catch (VkApiException ex)
     {
         makeLog(ex.Message);
     }
     catch (Exception ex)
     {
         makeLog(ex.Message);
     }
 }