Exemple #1
0
        private void p1_DoubleClick(object sender, EventArgs e)
        {
            int num = Array.IndexOf(PS, sender);

            if (num >= 0)
            {
                string text = missfs[num];
                openFileDialog1.Filter = "*.*|*.*||";
                if (text != null)
                {
                    openFileDialog1.Filter = text + "|" + text + "|*.*|*.*||";
                }
                openFileDialog1.FileName = text;
                if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
                {
                    string fileName = openFileDialog1.FileName;
                    pif.LoadOf(num, fileName);
                    PS[num].Image = Resources.Happy;
                    toolTip1.SetToolTip(PS[num], "Happy! there is no problem. Loaded file is ...\n\n" + fileName);
                    UtSearchf.AddDirToList(Path.GetDirectoryName(fileName));
                }
            }
        }
Exemple #2
0
        private void p1_DragDrop(object sender, DragEventArgs e)
        {
            var array = e.Data.GetData(DataFormats.FileDrop) as string[];

            if (array != null)
            {
                string[] array2 = array;
                int      num    = 0;
                if (num < array2.Length)
                {
                    string       text = array2[num];
                    PictureBox[] pS   = PS;
                    int          num2 = Array.IndexOf(pS, sender);
                    if (num2 >= 0)
                    {
                        pif.LoadOf(num2, text);
                        pif.DoRecalc();
                        pS[num2].Image = Resources.Happy;
                        toolTip1.SetToolTip(pS[num2], "Happy! there is no problem. Loaded file is ...\n\n" + text);
                        UtSearchf.AddDirToList(Path.GetDirectoryName(text));
                    }
                }
            }
        }
Exemple #3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            PictureBox[] pS         = PS;
            IEnumerator  enumerator = listBox1.SelectedItems.GetEnumerator();

            try
            {
                if (enumerator.MoveNext())
                {
                    var preset = (Preset)enumerator.Current;
                    for (int i = 0; i < 6; i++)
                    {
                        pS[i].Image = null;
                        toolTip1.SetToolTip(pS[i], null);
                        missfs[i] = null;
                    }
                    int num = 0;
                    for (int j = 0; j < 6; j++)
                    {
                        string nameOf = preset.GetNameOf(j);
                        if (nameOf.Length == 0)
                        {
                            pS[j].Image = Resources.DFH;
                        }
                        else
                        {
                            string text = UtSearchf.Find(nameOf);
                            if (text == null)
                            {
                                openFileDialog1.FileName = nameOf;
                                openFileDialog1.Filter   = string.Concat(new[]
                                {
                                    "Missing file ",
                                    nameOf,
                                    "|",
                                    nameOf,
                                    "|*.*|*.*||"
                                });
                                if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
                                {
                                    text = openFileDialog1.FileName;
                                    UtSearchf.AddDirToList(Path.GetDirectoryName(text));
                                }
                            }
                            if (text == null)
                            {
                                pS[j].Image = Resources.NG;
                                toolTip1.SetToolTip(pS[j],
                                                    "Missing file --- Find that file, then drag it and drop here.\n\n" + nameOf);
                                add2Log("Missing --- " + nameOf + "\n");
                                missfs[j] = nameOf;
                                num++;
                            }
                            else
                            {
                                pif.LoadOf(j, text);
                                pS[j].Image = Resources.Happy;
                                toolTip1.SetToolTip(pS[j], "Happy! no error. Loaded file is ...\n\n" + text);
                            }
                        }
                    }
                    pif.SetJointOf(1, preset.GetJointOf(1));
                    pif.SetJointOf(2, preset.GetJointOf(2));
                    if (num == 0)
                    {
                        add2Log("OK\n");
                    }
                    pif.DoRecalc();
                }
            }
            finally
            {
                var disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }