Пример #1
0
        public void handleCommonMouseDown(Object sender, MouseEventArgs e)
        {
            if (AppManager.getEditMode() != EditMode.NONE)
            {
                return;
            }
            DraggableBButton btn = (DraggableBButton)sender;

            if (mMainWindow != null)
            {
                mMainWindow.BringToFront();
            }

            IconDynamicsHandle handle = btn.getHandle();
            VsqEvent           item   = new VsqEvent();

            item.Clock   = 0;
            item.ID.Note = 60;
            item.ID.type = VsqIDType.Aicon;
            item.ID.IconDynamicsHandle = (IconDynamicsHandle)handle.clone();
            int length = handle.getLength();

            if (length <= 0)
            {
                length = 1;
            }
            item.ID.setLength(length);
            AppManager.mAddingEvent = item;

            btn.DoDragDrop(handle, System.Windows.Forms.DragDropEffects.All);
        }
Пример #2
0
        /// <summary>
        /// Displays this form with a given music file at a given position.
        /// </summary>
        /// <param name="mw">The main form's instance.</param>
        /// <param name="mf">The <see cref="MusicFile"/> class instance for which album image to display on this form.</param>
        /// <param name="top">The top position for the instance of this form.</param>
        public static void Show(FormMain mw, MusicFile mf, int top)
        {
            if (ThisInstance == null)
            {
                ThisInstance = new FormAlbumImage {
                    Owner = mw
                };
            }
            mf.LoadPic();
            try
            {
                if (mf.SongImage != null)
                {
                    ThisInstance.pbAlbum.Image = mf.SongImage;
                }
                else if (mf.Pictures != null && mf.Pictures.Length > 0)
                {
                    IPicture     pic = mf.Pictures[0];
                    MemoryStream ms  = new MemoryStream(pic.Data.Data)
                    {
                        Position = 0
                    };
                    Image im = Image.FromStream(ms);
                    ThisInstance.pbAlbum.Image = im;
                }
                else
                {
                    if (Program.Settings.AutoHideAlbumImage)
                    {
                        ThisInstance.Visible = false;
                        return;
                    }
                    ThisInstance.pbAlbum.Image = Resources.music_note;
                }
            }
            catch
            {
                if (Program.Settings.AutoHideAlbumImage)
                {
                    ThisInstance.Visible = false;
                    return;
                }
                ThisInstance.pbAlbum.Image = Resources.music_note;
            }

            ThisInstance.Visible = ThisInstance.pbAlbum.Image != null;
            if (firstShow && ThisInstance.Visible)
            {
                mw.BringToFront();
            }

            Reposition(mw, top);
        }
Пример #3
0
        static void Main()
        {
            //Get the running instance.
            Process instance = RunningInstance();

            if (instance == null)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.DoEvents();

                //開啟資料庫;//
                DaoSQL.Instance.OpenDatabase();

                while (true)
                {
                    DialogResult Ret = DialogResult.Cancel;

                    //Login畫面;//
                    Ret = ShowLoginForm();
                    if (Ret != DialogResult.OK)
                    {
                        break;
                    }

                    //登入成功,顯示主畫面;//
                    FormMain fMain = new FormMain();
                    fMain.BringToFront();
                    Ret = fMain.ShowDialog();

                    //釋放主畫面資源;//
                    fMain.Close();
                    fMain.Dispose();

                    //判斷是否為關閉視窗//
                    if (Ret != DialogResult.Retry)
                    {
                        break;
                    }
                }
            }
            else
            {
                //There is another instance of this process.
                HandleRunningInstance(instance);
            }

            //強制關閉,避免因thread或是timer尚在啟動,造成程式無法關閉;//
            Environment.Exit(Environment.ExitCode);
        }
Пример #4
0
        /// <summary>
        /// Shows Main form if it is the last form remaining (called upon hiding another form)
        /// </summary>
        /// <remarks>
        /// WTF MICROSOFT, WHY DOES IT GO OUT OF FOCUS!?
        /// EDIT: Apparently, if you show a form from a form, it will happen, so all forms that open forms should have this line
        /// Stupid Miscrosoft...
        /// </remarks>
        public static void ShowMainFormIfRequired()
        {
            int countOpenforms = 0;

            foreach (Form form in AllOwnedForms)
            {
                if (form.Visible)
                {
                    countOpenforms++;
                }
            }
            if (countOpenforms == 0)
            {
                FormMainInstance.BringToFront();
            }
        }
Пример #5
0
        static void Main()
        {
            //Get the running instance.
            Process instance = RunningInstance();

            if (instance == null)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.DoEvents();

                Logger.Info("LPS application booting.");

                //檢查必要的安裝檔;//
                CheckNecessaryInstaller();

                //開啟資料庫;//
                DaoSQL.Instance.OpenDatabase();

                while (true)
                {
                    //驗證本機序號;//
                    if (FormSnVerify.VerifyMachineSN() == false)
                    {
                        Logger.Info("SN verify failure from program.");
                        break;
                    }

                    DialogResult Ret = DialogResult.Cancel;

                    //Login畫面;//
                    Ret = ShowLoginForm();
                    if (Ret != DialogResult.OK)
                    {
                        Logger.Info("LPS application is closed from login form.");
                        break;
                    }

                    Logger.Info("LPS login success.");

                    //登入成功,顯示主畫面;//
                    FormMain LpsMain = new FormMain(m_Machine, m_LoginUser);
                    LpsMain.BringToFront();
                    Ret = LpsMain.ShowDialog();
                    //Application.Run(LpsMain);

                    //釋放主畫面資源;//
                    LpsMain.Close();
                    LpsMain.Dispose();

                    //判斷是否為關閉視窗//
                    if (Ret != DialogResult.Retry)
                    {
                        Logger.Info("LPS application is closed from main form.");
                        break;
                    }

                    Logger.Info("LPS main from logout.");
                }
            }
            else
            {
                //There is another instance of this process.
                HandleRunningInstance(instance);
            }

            //啟動備份流程;//
            BackupProc();

            Logger.Info("LPS application close.");

            //強制關閉,避免因thread或是timer尚在啟動,造成程式無法關閉;//
            Environment.Exit(Environment.ExitCode);
        }
Пример #6
0
        //public static FormTASRecorder inputRecorderForm;

        public static void Startup()
        {
            Settings newSettings = new Settings();

            logForm = new FormLog();
            logForm.Show();
            mainForm.BringToFront();
            Log("Starting Up....", Enums.LogMessageType.Basic);
            mainForm.labelVersion.Text = version;
            logForm.Location           = new System.Drawing.Point(mainForm.Location.X, mainForm.Location.Y + mainForm.Height + 8);
            IO.InputController.Start();
            programs.Add(new BuiltIn.InputSender.InputSender());
            programs.Add(new BuiltIn.vJoyInterface.vJoy_Emu());
            programs.Add(new BuiltIn.InputDisplay.InputDisplay());
            programs.Add(new BuiltIn.FPSMaster.FPSMaster());
            for (int i = 0; i < programs.Count; i += 1)
            {
                Log("Added program: " + programs[i].name + " | " + programs[i].versionID, Enums.LogMessageType.Basic);
                programs[i].Load();
                mainForm.comboBoxProgram.Items.Add(programs[i].name);
            }
            mainForm.comboBoxProgram.Items.Add("--Install a new Program--");
            if (!File.Exists(appFolder + "/" + "settings.js"))
            {
                settings.ResetToDefaults();
                Log("Creating New Settings.", Enums.LogMessageType.Basic);
            }
            else
            {
                try
                {
                    newSettings = JsonConvert.DeserializeObject <Settings>(File.ReadAllText(appFolder + "/" + "settings.js"));
                    settings    = newSettings;
                    //Log("Loaded Settings.", Enums.LogMessageType.Basic);
                    if (settings.version != version)
                    {
                        Log("You have updated to NentendoSharp " + version + " successfully!", Enums.LogMessageType.Basic);
                        settings.version = version;
                    }
                }
                catch (Exception exc)
                {
                    Log("Error Loading Settings:\n" + exc.ToString(), Enums.LogMessageType.Error);
                    settings = new Settings();
                    settings.ResetToDefaults();
                }
            }
            File.WriteAllText(appFolder + "/" + "settings.js", JsonConvert.SerializeObject(settings));
            //Log("Settings Saved.", Enums.LogMessageType.Basic);
            if (firstStart)
            {
                Log("Startup Complete! Welcome to NintendoSharp Newb!", Enums.LogMessageType.Basic);
            }
            else
            {
                Log("Startup Complete! Welcome to NintendoSharp!", Enums.LogMessageType.Basic);
            }
            LogBufferTimer          = new System.Windows.Forms.Timer();
            LogBufferTimer.Interval = 100;
            LogBufferTimer.Tick    += tmLog_Tick;
            LogBufferTimer.Start();
            updateThread = new Thread(UpdateThread);
            updateThread.Start();
        }