コード例 #1
0
ファイル: PostUpdate.cs プロジェクト: JakeStevenson/PockeTwit
        private void InsertPictureFromFile()
        {
            if (!uploadingPicture)
            {
                String pictureUrl = string.Empty;
                using (Microsoft.WindowsMobile.Forms.SelectPictureDialog s = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
                {
                    if (s.ShowDialog() == DialogResult.OK)
                    {
                        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PostUpdate));
                        this.pictureFromCamers.Image = PockeTwit.Themes.FormColors.GetThemeIcon("takepicture.png");
                        if (DetectDevice.DeviceType == DeviceType.Standard)
                        {
                            this.pictureFromCamers.Visible = false;
                        }
                        uploadedPictureOrigin = "file";

                        pictureService = GetMediaService();
                        if (pictureService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
                        {
                            AddPictureToForm(s.FileName, pictureFromStorage);
                            picturePath = s.FileName;
                            //Reduce length of message 140-pictureService.UrlLength
                            pictureUsed = true;
                        }
                        else
                        {
                            uploadingPicture = true;
                            AddPictureToForm(ClientSettings.IconsFolder() + "wait.png", pictureFromStorage);
                            using (PicturePostObject ppo = new PicturePostObject())
                            {
                                ppo.Filename = s.FileName;
                                ppo.Username = AccountToSet.UserName;
                                ppo.Password = AccountToSet.Password;
                                ppo.UseAsync = false;
                                Cursor.Current = Cursors.WaitCursor;
                                pictureService.PostPicture(ppo);
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Uploading picture...");
            }
        }
コード例 #2
0
ファイル: PostUpdate.cs プロジェクト: JakeStevenson/PockeTwit
 private void InsertPictureFromFile()
 {
     if (!uploadingPicture)
     {
         String pictureUrl = string.Empty;
         String filename = string.Empty;
         //using (Microsoft.WindowsMobile.Forms.SelectPictureDialog s = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
         try
         {
             pictureService = GetMediaService();
             using (Microsoft.WindowsMobile.Forms.SelectPictureDialog s = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
             {
                 //s.Filter = string.Empty; //all files //pictureService.FileFilter;
                 s.Filter = pictureService.FileFilter;
                 
                 if (s.ShowDialog() == DialogResult.OK)
                 {
                     filename = s.FileName;
                     ComponentResourceManager resources = new ComponentResourceManager(typeof(PostUpdate));
                     pictureFromCamers.Image = FormColors.GetThemeIcon("takepicture.png");
                     if (DetectDevice.DeviceType == DeviceType.Standard)
                     {
                         pictureFromCamers.Visible = false;
                     }
                     uploadedPictureOrigin = "file";
                 }
                 else //cancelled
                 {
                     pictureUsed = true;
                 }
             }
         }
         catch
         {
             MessageBox.Show("Unable to select picture.", "PockeTwit");
         }
         if  (string.IsNullOrEmpty(filename))
         {
             return;
         }
         try
         {
             if (pictureService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
             {
                 AddPictureToForm(filename, pictureFromStorage);
                 picturePath = filename;
                 //Reduce length of message 140-pictureService.UrlLength
                 pictureUsed = true;
             }
             else
             {
                 uploadingPicture = true;
                 AddPictureToForm(FormColors.GetThemeIconPath("wait.png"), pictureFromStorage);
                 using (PicturePostObject ppo = new PicturePostObject())
                 {
                     ppo.Filename = filename;
                     ppo.Username = AccountToSet.UserName;
                     ppo.Password = AccountToSet.Password;
                     ppo.UseAsync = false;
                     Cursor.Current = Cursors.WaitCursor;
                     pictureService.PostPicture(ppo);
                 }
             }
         }
         catch
         {
             MessageBox.Show("Unable to upload picture.", "PockeTwit");
         } 
     }
     else
     {
         MessageBox.Show("Uploading picture...");
     }
 }
コード例 #3
0
ファイル: PostUpdate.cs プロジェクト: enersia/pocketwit
 private string SelectFileVisual(String fileFilter)
 {
     string filename = string.Empty;
     using (Microsoft.WindowsMobile.Forms.SelectPictureDialog fileDialog = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
     {
         fileDialog.Filter = fileFilter;
         fileDialog.Owner = this;
         this.WindowState = FormWindowState.Normal;
         if (fileDialog.ShowDialog() == DialogResult.OK)
         {
             filename = fileDialog.FileName;
             fileDialog.Dispose();
         }
         if (ClientSettings.IsMaximized)
             this.WindowState = FormWindowState.Maximized;
     }
     return filename;
 }
コード例 #4
0
ファイル: PostUpdate.cs プロジェクト: JakeStevenson/PockeTwit
 private string SelectFileVisual(String fileFilter)
 {
     string filename = string.Empty;
     using (Microsoft.WindowsMobile.Forms.SelectPictureDialog fileDialog = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
     {
         fileDialog.Filter = fileFilter;
         if (fileDialog.ShowDialog() == DialogResult.OK)
         {
             filename = fileDialog.FileName;
         }
     }
     return filename;
 }
コード例 #5
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.mainMenu1 = new System.Windows.Forms.MainMenu();
      this.autodetectSensorsButton = new System.Windows.Forms.Button();
      this.applyConfigurationButton = new System.Windows.Forms.Button();
      this.sensor4Label = new System.Windows.Forms.Label();
      this.sensor3Label = new System.Windows.Forms.Label();
      this.sensor2Label = new System.Windows.Forms.Label();
      this.sensor1Label = new System.Windows.Forms.Label();
      this.sensorListBox4 = new System.Windows.Forms.ListBox();
      this.sensorListBox3 = new System.Windows.Forms.ListBox();
      this.sensorListBox2 = new System.Windows.Forms.ListBox();
      this.sensorListBox1 = new System.Windows.Forms.ListBox();
      this.sensorTypesLabel = new System.Windows.Forms.Label();
      this.serverNameBox = new System.Windows.Forms.TextBox();
      this.serverNameLabel = new System.Windows.Forms.Label();
      this.serverNameTextBox = new System.Windows.Forms.TextBox();
      this.label6 = new System.Windows.Forms.Label();
      this.descriptionLabel = new System.Windows.Forms.Label();
      this.serverDescriptionTextBox = new System.Windows.Forms.TextBox();
      this.serverImageLabel = new System.Windows.Forms.Label();
      this.serverImageBox = new System.Windows.Forms.PictureBox();
      this.newImageLinkLabel = new System.Windows.Forms.LinkLabel();
      this.selectImageDialog = new Microsoft.WindowsMobile.Forms.SelectPictureDialog();
      this.label1 = new System.Windows.Forms.Label();
      this.serverLocationTextBox = new System.Windows.Forms.TextBox();
      this.SuspendLayout();
      //
      // autodetectSensorsButton
      //
      this.autodetectSensorsButton.Location = new System.Drawing.Point(20, 159);
      this.autodetectSensorsButton.Name = "autodetectSensorsButton";
      this.autodetectSensorsButton.Size = new System.Drawing.Size(138, 22);
      this.autodetectSensorsButton.TabIndex = 15;
      this.autodetectSensorsButton.Text = "Autodetect sensors";
      //
      // applyConfigurationButton
      //
      this.applyConfigurationButton.Location = new System.Drawing.Point(132, 218);
      this.applyConfigurationButton.Name = "applyConfigurationButton";
      this.applyConfigurationButton.Size = new System.Drawing.Size(103, 24);
      this.applyConfigurationButton.TabIndex = 14;
      this.applyConfigurationButton.Text = "Apply All";
      //
      // sensor4Label
      //
      this.sensor4Label.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.sensor4Label.Location = new System.Drawing.Point(3, 138);
      this.sensor4Label.Name = "sensor4Label";
      this.sensor4Label.Size = new System.Drawing.Size(16, 15);
      this.sensor4Label.Text = "4";
      //
      // sensor3Label
      //
      this.sensor3Label.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.sensor3Label.Location = new System.Drawing.Point(3, 116);
      this.sensor3Label.Name = "sensor3Label";
      this.sensor3Label.Size = new System.Drawing.Size(16, 15);
      this.sensor3Label.Text = "3";
      //
      // sensor2Label
      //
      this.sensor2Label.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.sensor2Label.Location = new System.Drawing.Point(3, 94);
      this.sensor2Label.Name = "sensor2Label";
      this.sensor2Label.Size = new System.Drawing.Size(16, 15);
      this.sensor2Label.Text = "2";
      //
      // sensor1Label
      //
      this.sensor1Label.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.sensor1Label.Location = new System.Drawing.Point(3, 72);
      this.sensor1Label.Name = "sensor1Label";
      this.sensor1Label.Size = new System.Drawing.Size(16, 15);
      this.sensor1Label.Text = "1";
      //
      // sensorListBox4
      //
      this.sensorListBox4.Location = new System.Drawing.Point(20, 137);
      this.sensorListBox4.Name = "sensorListBox4";
      this.sensorListBox4.Size = new System.Drawing.Size(215, 16);
      this.sensorListBox4.TabIndex = 6;
      //
      // sensorListBox3
      //
      this.sensorListBox3.Location = new System.Drawing.Point(20, 115);
      this.sensorListBox3.Name = "sensorListBox3";
      this.sensorListBox3.Size = new System.Drawing.Size(215, 16);
      this.sensorListBox3.TabIndex = 5;
      //
      // sensorListBox2
      //
      this.sensorListBox2.Location = new System.Drawing.Point(20, 93);
      this.sensorListBox2.Name = "sensorListBox2";
      this.sensorListBox2.Size = new System.Drawing.Size(215, 16);
      this.sensorListBox2.TabIndex = 4;
      //
      // sensorListBox1
      //
      this.sensorListBox1.Location = new System.Drawing.Point(20, 71);
      this.sensorListBox1.Name = "sensorListBox1";
      this.sensorListBox1.Size = new System.Drawing.Size(215, 16);
      this.sensorListBox1.TabIndex = 3;
      //
      // sensorTypesLabel
      //
      this.sensorTypesLabel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.sensorTypesLabel.Location = new System.Drawing.Point(3, 49);
      this.sensorTypesLabel.Name = "sensorTypesLabel";
      this.sensorTypesLabel.Size = new System.Drawing.Size(96, 19);
      this.sensorTypesLabel.Text = "Sensor types";
      //
      // serverNameBox
      //
      this.serverNameBox.Location = new System.Drawing.Point(3, 25);
      this.serverNameBox.Name = "serverNameBox";
      this.serverNameBox.Size = new System.Drawing.Size(233, 21);
      this.serverNameBox.TabIndex = 1;
      //
      // serverNameLabel
      //
      this.serverNameLabel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.serverNameLabel.Location = new System.Drawing.Point(3, 4);
      this.serverNameLabel.Name = "serverNameLabel";
      this.serverNameLabel.Size = new System.Drawing.Size(100, 18);
      this.serverNameLabel.Text = "Server name";
      //
      // serverNameTextBox
      //
      this.serverNameTextBox.Location = new System.Drawing.Point(40, 3);
      this.serverNameTextBox.Name = "serverNameTextBox";
      this.serverNameTextBox.Size = new System.Drawing.Size(200, 21);
      this.serverNameTextBox.TabIndex = 1;
      //
      // label6
      //
      this.label6.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.label6.Location = new System.Drawing.Point(0, 3);
      this.label6.Name = "label6";
      this.label6.Size = new System.Drawing.Size(50, 18);
      this.label6.Text = "Name:";
      //
      // descriptionLabel
      //
      this.descriptionLabel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.descriptionLabel.Location = new System.Drawing.Point(3, 51);
      this.descriptionLabel.Name = "descriptionLabel";
      this.descriptionLabel.Size = new System.Drawing.Size(100, 18);
      this.descriptionLabel.Text = "Description:";
      //
      // serverDescriptionTextBox
      //
      this.serverDescriptionTextBox.Location = new System.Drawing.Point(3, 66);
      this.serverDescriptionTextBox.Multiline = true;
      this.serverDescriptionTextBox.Name = "serverDescriptionTextBox";
      this.serverDescriptionTextBox.Size = new System.Drawing.Size(234, 85);
      this.serverDescriptionTextBox.TabIndex = 2;
      //
      // serverImageLabel
      //
      this.serverImageLabel.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.serverImageLabel.Location = new System.Drawing.Point(6, 154);
      this.serverImageLabel.Name = "serverImageLabel";
      this.serverImageLabel.Size = new System.Drawing.Size(100, 18);
      this.serverImageLabel.Text = "Server Image";
      //
      // serverImageBox
      //
      this.serverImageBox.Location = new System.Drawing.Point(6, 175);
      this.serverImageBox.Name = "serverImageBox";
      this.serverImageBox.Size = new System.Drawing.Size(226, 84);
      //
      // newImageLinkLabel
      //
      this.newImageLinkLabel.ForeColor = System.Drawing.Color.CornflowerBlue;
      this.newImageLinkLabel.Location = new System.Drawing.Point(144, 154);
      this.newImageLinkLabel.Name = "newImageLinkLabel";
      this.newImageLinkLabel.Size = new System.Drawing.Size(92, 19);
      this.newImageLinkLabel.TabIndex = 5;
      this.newImageLinkLabel.Text = "Select new...";
      this.newImageLinkLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
      this.newImageLinkLabel.Click += new System.EventHandler(this.newImageLinkLabel_Click);
      //
      // selectImageDialog
      //
      this.selectImageDialog.Filter = "JPEG Images|*.jpg";
      //
      // label1
      //
      this.label1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold);
      this.label1.Location = new System.Drawing.Point(0, 27);
      this.label1.Name = "label1";
      this.label1.Size = new System.Drawing.Size(103, 18);
      this.label1.Text = "Location:";
      //
      // serverLocationTextBox
      //
      this.serverLocationTextBox.Location = new System.Drawing.Point(60, 27);
      this.serverLocationTextBox.Name = "serverLocationTextBox";
      this.serverLocationTextBox.Size = new System.Drawing.Size(180, 21);
      this.serverLocationTextBox.TabIndex = 17;
      //
      // ServerConfig
      //
      this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
      this.AutoScroll = true;
      this.ClientSize = new System.Drawing.Size(240, 268);
      this.Controls.Add(this.serverLocationTextBox);
      this.Controls.Add(this.label1);
      this.Controls.Add(this.newImageLinkLabel);
      this.Controls.Add(this.serverImageBox);
      this.Controls.Add(this.serverImageLabel);
      this.Controls.Add(this.serverDescriptionTextBox);
      this.Controls.Add(this.descriptionLabel);
      this.Controls.Add(this.serverNameTextBox);
      this.Controls.Add(this.label6);
      this.Menu = this.mainMenu1;
      this.Name = "ServerConfig";
      this.Text = "Server Configuration";
      this.ResumeLayout(false);
 }