[C#] T.I.M Product Previewer - Source

DataMine
by DataMine · 9 posts
12 years ago in .Net (C#, VB, etc)
Posted 12 years ago · Author
This was a tool I wrote a long time ago before Imvu introduced the in client shop and create mode. Its purpose was to take a pid and open it in peer review mode for you to look at and see if you like it before you buy or wishlist it.

I just found the source code on my drive again so I thought I would post it. This was my first attempt at making something in c# so it's pretty ugly lol.

Image

Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace ImvuMafiasProductPreviewer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        // Paste From Clipboard Menu Item
        private void pasteFromClipboardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Check For Characters In The Input Box
            if (PIDBox.Text.Length >= 1) //If Characters Found
            {
                PIDBox.Clear(); //Clear The Input Box
                PIDBox.Text = Clipboard.GetText(); //Paste Charatcers From Clipboard
            }
            else //If No Characters Found
            {
                PIDBox.Text = Clipboard.GetText(); //Paste Charatcers From Clipboard
            }
        }
        //End Paste From Clipboard Menu Item
        //Clear Menu Item
        private void clearInputToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PIDBox.Clear();
        }
        //End Clear Menu Item
        //Close Menu Item
        private void closeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close(); //Exit Program
        }
        //End Menu Item
        //Open Imvu Catalog Menu Item
        private void openImvuCatalogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process.Start("http://www.imvu.com/shop/");
        }
        //End Open Imvu Catalog Menu Item
        //Visit The Imvu Mafias Menu Item
        private void visitTheImvuMafiasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process.Start("https://www.imvumafias.org/community/index.php");
        }
        //End Visit The Imvu Mafias Menu Item
        //Toggle Focus Menu Item
        private void toggleFocusToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (this.TopMost == true) //If The Form Is Already On Top
            {
                this.TopMost = false; //Set The Forms Focus Always On Top Focus Off
                FocusLabel.Text = "Focus Off"; //Change The Focus Label Text To Off
                FocusLabel.ForeColor = Color.Firebrick; //Change The Focus Label Font Color To A Darker Red
            }
            else //If The Form Is Not On Top
            {
                this.TopMost = true; //Set The Forms Focus Always On Top Focus On
                FocusLabel.Text = "Focus On"; //Change The Focus Label Text To On
                FocusLabel.ForeColor = Color.Green; //Change The Focus Label Font Color To Green
            }
        }
        //End Toggle Focus Menu Item
        // Preview PID Button
        private void PreviewButton_Click(object sender, EventArgs e)
        {
            //Declare Variables
            bool IsNumber = true;
            string IDString = PIDBox.Text;

            if (PIDBox.Text.Length < 2)  //If Input Is Too Short
            {
                PIDBox.Text = "Enter A Product Id Number"; //Prompt User To Input PID
            }
            else //If Input Length Is Correct
            {
                for (int i = 0; i < PIDBox.Text.Length; i++)
                {
                    // Goes Through Each Character & Checks If It Is A Number
                    if ((IDString[i] < '0') || (IDString[i] > '9')) IsNumber = false;
                }

                if (IsNumber) //If All Characters Are Numbers
                {
                    Process.Start("imvu:PeerReview?mcg=0&pid=" + IDString); //Run The PID
                }
                else //If Input Contains A Number
                {
                    PIDBox.Text = "Enter A Product Id Number"; //Prompt User To Input A PID
                }

            }
        }
        //Beginning No Letters Allowed In InputBox
        private void PIDBox_KeyPress(object sender, KeyPressEventArgs e)
        {         
            if ((e.KeyChar < '0' || e.KeyChar > '9') && (e.KeyChar != '\b'))
            {
                e.Handled = true;
            }
            else
            {
                e.Handled = false;
            }       
        }
        //End No Letters Allowed In InputBox
        //Check Input Box For Text
        private void PIDBox_Click(object sender, EventArgs e)
        {
            if (PIDBox.Text == "Enter A Product Id Number")
            {
                PIDBox.Clear();
            }
        }
        //End Check Input Box For Text
        //Beginning DropDownMenu Item Highlight Forecolor Change
        private void pasteFromClipboardToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {
            pasteFromClipboardToolStripMenuItem.ForeColor = Color.Blue;
        }

        private void pasteFromClipboardToolStripMenuItem_MouseLeave(object sender, EventArgs e)
        {
            pasteFromClipboardToolStripMenuItem.ForeColor = Color.DarkGray;
        }

        private void clearInputToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {
            clearInputToolStripMenuItem.ForeColor = Color.Blue;
        }

        private void clearInputToolStripMenuItem_MouseLeave(object sender, EventArgs e)
        {
            clearInputToolStripMenuItem.ForeColor = Color.DarkGray;
        }
        private void openImvuCatalogToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {
            openImvuCatalogToolStripMenuItem.ForeColor = Color.Blue;
        }
        private void openImvuCatalogToolStripMenuItem_MouseLeave(object sender, EventArgs e)
        {
            openImvuCatalogToolStripMenuItem.ForeColor = Color.DarkGray;
        }
        private void toggleFocusToolStripMenuItem1_MouseEnter(object sender, EventArgs e)
        {
            toggleFocusToolStripMenuItem1.ForeColor = Color.Blue;
        }
        private void toggleFocusToolStripMenuItem1_MouseLeave(object sender, EventArgs e)
        {
            toggleFocusToolStripMenuItem1.ForeColor = Color.DarkGray;
        }
        private void visitTheImvuMafiasToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {
            visitTheImvuMafiasToolStripMenuItem.ForeColor = Color.Blue;
        }
        private void visitTheImvuMafiasToolStripMenuItem_MouseLeave(object sender, EventArgs e)
        {
            visitTheImvuMafiasToolStripMenuItem.ForeColor = Color.DarkGray;
        }   
        private void toggleFocusToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {
            toggleFocusToolStripMenuItem1.ForeColor = Color.Blue;
        }
        private void toggleFocusToolStripMenuItem_MouseLeave(object sender, EventArgs e)
        {
            toggleFocusToolStripMenuItem1.ForeColor = Color.DarkGray;
        }
        //Beginning ToolStripMenu Items Forcolor Change
        private void fileToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
        {
            fileToolStripMenuItem.ForeColor = Color.Black;
        }

        private void fileToolStripMenuItem_DropDownClosed(object sender, EventArgs e)
        {
            fileToolStripMenuItem.ForeColor = Color.White;
        }

        private void toolsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
        {
            toolsToolStripMenuItem.ForeColor = Color.Black;
        }

        private void toolsToolStripMenuItem_DropDownClosed(object sender, EventArgs e)
        {
            toolsToolStripMenuItem.ForeColor = Color.White;
        }

        private void optionsToolStripMenuItem1_DropDownOpened(object sender, EventArgs e)
        {
            optionsToolStripMenuItem1.ForeColor = Color.Black;
        }

        private void optionsToolStripMenuItem1_DropDownClosed(object sender, EventArgs e)
        {
            optionsToolStripMenuItem1.ForeColor = Color.White;
        }

        private void helpToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
        {
            helpToolStripMenuItem.ForeColor = Color.Black;
        }

        private void helpToolStripMenuItem_DropDownClosed(object sender, EventArgs e)
        {
            helpToolStripMenuItem.ForeColor = Color.White;
        }
        //End ToolStripMenu Items Forcolor Change
    }
}



Click here to download the full source code.
Posted 12 years ago
I remember this from a while back, I used to use it when I had PIDs but I didn't have the client up at the time.
Posted 12 years ago · Author
//.Spring wrote:
I remember this from a while back, I used to use it when I had PIDs but I didn't have the client up at the time.


How? It opens the product in the client when you enter the pid.
Posted 12 years ago
I didn't have it up atm, It was sitting in my taskbar with just the icon.
Posted 12 years ago
Ð▪ℳ wrote:
I just found the source code on my drive again so I thought I would post it. This was my first attempt at making something in c# so it's pretty ugly lol.


I must have no style, because it looks damn pretty to me.
Posted 12 years ago · Author
Don Von Free Credits wrote:
Ð▪ℳ wrote:
I just found the source code on my drive again so I thought I would post it. This was my first attempt at making something in c# so it's pretty ugly lol.


I must have no style, because it looks damn pretty to me.


I meant the code itself was ugly. I quite liked the GUI.
Posted 12 years ago
Changed up the GUI - Image

Cleaned some of the code. Just did a little testing of my own, there's a tad bit of non-working code in there but I hope to finish it one day, it's the code to Kill the IMVU client process, I haven't gotten that to work yet but as of now there is an option for it to open up the client for you.

Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace ProductPreviewer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void openIMVUHomepageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process.Start("http://www.imvu.com/");
        }

        private void pastePIDFromClipboardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Check For Characters In The Input Box
            if (PIDBox.Text.Length >= 1) //If Characters Found
            {
                PIDBox.Clear(); //Clear The Input Box
                PIDBox.Text = Clipboard.GetText(); //Paste Characters From Clipboard
            }
            else //If No Characters Found
            {
                PIDBox.Text = Clipboard.GetText(); //Paste Characters From Clipboard
            }
        }
        //End Paste From Clipboard Menu Item
        //Clear Menu Item
        private void clearInputToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PIDBox.Clear();
        }

        private void closeProgramToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close(); //Exit Program
        }
        //End Open Imvu Catalog Menu Item
        //Visit The Imvu Mafias Menu Item
        private void openTIMHomepageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process.Start("https://www.imvumafias.org/community/index.php");
        }

        private void PreviewButton_Click(object sender, EventArgs e)
        {
            //Declare Variables
            bool IsNumber = true;
            string IDString = PIDBox.Text;

            if (PIDBox.Text.Length < 2)  //If Input Is Too Short
            {
                PIDBox.Text = "Enter A Product Id Number"; //Prompt User To Input PID
            }
            else //If Input Length Is Correct
            {
                for (int i = 0; i < PIDBox.Text.Length; i++)
                {
                    // Goes Through Each Character & Checks If It Is A Number
                    if ((IDString[i] < '0') || (IDString[i] > '9')) IsNumber = false;
                }

                if (IsNumber) //If All Characters Are Numbers
                {
                    Process.Start("imvu:PeerReview?mcg=0&pid=" + IDString); //Run The PID
                }
                else //If Input Contains A Number
                {
                    PIDBox.Text = "Enter A Product Id Number"; //Prompt User To Input A PID
                }
            }
        }
        //Check Input Box For Text
        private void PIDBox_KeyPress(object sender, EventArgs e)
        {
            if (PIDBox.Text == "Enter A Product Id Number")
            {
                PIDBox.Clear();
            }

        }
        //End Check Input Box For Text
        //Beginning DropDownMenu Item Highlight Forecolor_Change
        private void pasteFromClipboardToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {

        }

        private void clearInputToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {
            clearInputToolStripMenuItem.ForeColor = Color.Blue;
        }

        private void clearInputToolStripMenuItem_MouseLeave(object sender, EventArgs e)
        {
            clearInputToolStripMenuItem.ForeColor = Color.DarkGray;
        }
        private void openImvuCatalogToolStripMenuItem_MouseEnter(object sender, EventArgs e)
        {

        }   
        //Beginning ToolStripMenu Items Forcolor Change
        private void fileToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
        {
            fileToolStripMenuItem.ForeColor = Color.Black;
        }

        private void fileToolStripMenuItem_DropDownClosed(object sender, EventArgs e)
        {
            fileToolStripMenuItem.ForeColor = Color.White;
        }

        private void toolsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
        {
            toolsToolStripMenuItem.ForeColor = Color.Black;
        }

        private void toolsToolStripMenuItem_DropDownClosed(object sender, EventArgs e)
        {
            toolsToolStripMenuItem.ForeColor = Color.White;
        }

        private void openIMVUMafiasHomepageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Process.Start("https://www.imvumafias.org/community/index.php");
        }

        private void openIMVUClientToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Opens IMVUClient if already opened, if not it opens it for you.
            Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\IMVUClient\IMVUClient.exe");
        }

        private void endIMVUProcessToolStripMenuItem_Click(object sender, EventArgs e)
        {
         
            try
            {
                Process[] proc = Process.GetProcessesByName("IMVUQualityAgent.exe");
                foreach (System.Diagnostics.Process myProc in System.Diagnostics.Process.GetProcesses())
                {
                    if (myProc.ProcessName == "imvuqualityagent.exe")
                    {
                        myProc.Kill();
                    }
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
    }
}
Posted 10 years ago · Author
//.Spring wrote:
Changed up the GUI - Image ~snip~


Oh nice, I like to see people finding a use for the code. :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT