Beispiel #1
0
        private IntPtr ProcessCustomMainContext(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            if (!handled)
            {
                switch ((uint)msg)
                {
                case WM_SYSCOMMAND:
                    //debugout(msg, wParam, lParam);
                    int hiP = High16(wParam);    // Flags
                    int loP = Low16(wParam);     //menu item
                    MessageBoxResult mbr;

                    switch (loP)
                    {
                    case WindowExtensions.SettingsSysMenuID:
                        MessageBox.Show("Settingstext", "Caption Settings", MessageBoxButton.OK, MessageBoxImage.Information);
                        handled = true;
                        break;

                    case WindowExtensions.AboutSysMenuID:
                        MessageBox.Show("About text", "Caption About", MessageBoxButton.OK, MessageBoxImage.Information);
                        handled = true;
                        break;

                    case WindowExtensions.AddDlgMenuID:
                        mbr = MessageBox.Show("Create new dialog?", "New Dialog", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                        {
                            if (mbr == MessageBoxResult.OK)
                            {
                                KO_Dialog dlg = new KO_Dialog();
                                dlg.Show();
                            }
                        }
                        handled = true;
                        break;

                    case WindowExtensions.CloseSysMenuID:
                        mbr = MessageBox.Show("Close all dialogs?", "Close App", MessageBoxButton.OKCancel, MessageBoxImage.Question);

                        if (mbr == MessageBoxResult.OK)
                        {
                            foreach (KO_Dialog od in OpenDialogs)
                            {
                                od.Close();
                            }
                        }
                        handled = true;
                        break;
                    }
                    break;
                }
            }
            return(IntPtr.Zero);
        }
Beispiel #2
0
        public void SetProgramState()
        {
            ProgramState = string.Empty;

            if (DlgParams != string.Empty)
            {
                ProgramState = this.DlgParams;
            }
            else
            {
                ProgramState = lnkio.ReadProgramState();
            }

            if (string.Empty != ProgramState)
            {
                // break up the settings on the & character to seperate dialogs
                string[] dlgs = ProgramState.Split(new string[] { "&" }, StringSplitOptions.RemoveEmptyEntries);

                bool IsMain = true;

                foreach (string d in dlgs)
                {
                    if (IsMain)
                    {
                        // Break up on the newline or return and newline
                        string[] s = d.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries); // '\n');
                        if (s.Length >= 6)
                        {
                            // first saved parameter is program name and second is timestamp, the remainder define the main and sub-dialogs

                            this.Top    = Double.Parse(s[2]);
                            this.Left   = Double.Parse(s[3]);
                            this.Height = Double.Parse(s[4]);
                            this.Width  = Double.Parse(s[5]);

                            //Application.Current.KO_Dialog.Top = Double.Parse(s[2]);
                            //Application.Current.KO_Dialog.Left = Double.Parse(s[3]);
                            //Application.Current.KO_Dialog.Height = Double.Parse(s[4]);
                            //Application.Current.KO_Dialog.Width = Double.Parse(s[5]);

                            // skip the first 6 lines and process the icon parameters for the main dialog
                            IEnumerable <string> items = s.Skip(6);
                            s = items.ToArray <string>();

                            CreateShortCuts(s);

                            PlaceShortcutsintoView();// s);
                        }
                        IsMain = false;
                    }
                    else
                    {
                        if (d != string.Empty)
                        {
                            string[] s = d.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                            if (s.Length >= 6)
                            {
                                KO_Dialog dlg = new KO_Dialog(d);
                                dlg.Show();
                                //OpenDialogs.Add(dlg);
                            }
                        }
                    }
                }
            }
        }