Ejemplo n.º 1
0
 //Инициализация MDI окон после окончательной загрузки формы
 private void WindowDisc_Loaded(object sender, RoutedEventArgs e)
 {
     mdiChildWord = new MdiChild()
     {
         Title       = "DOC",
         Name        = "Word",
         WindowState = WindowState.Normal,
         Width       = MdiContainer.ActualWidth,
         Height      = MdiContainer.ActualHeight,
         Content     = richTextBox
     };
     mdiChildPDF = new MdiChild()
     {
         Title       = "PDF",
         Name        = "PDF",
         WindowState = WindowState.Normal,
         Width       = MdiContainer.ActualWidth,
         Height      = MdiContainer.ActualHeight,
         Content     = webBrowser
     };
     mdiChildVideo = new MdiChild()
     {
         Title       = "Video",
         Name        = "Video",
         WindowState = WindowState.Normal,
         Width       = MdiContainer.ActualWidth,
         Height      = MdiContainer.ActualHeight,
     };
 }
Ejemplo n.º 2
0
 private void AddFieldWindowGotFocusEventHandler(MdiChild child)
 {
     child.GotFocus += delegate
     {
         MainWindow.lastFocusedIndex = windowContainer.Children.IndexOf(child);
     };
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Show (MIDI) tracks/timbres.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            {
                // Check if already exists. If so, show the already opened window.
                foreach (var child in from child in _mainWindow.Container.Children
                         where (child.Content is SongTimbresWindow)
                         let sngTimbresIteration = child.Content as SongTimbresWindow
                                                   where sngTimbresIteration.SngTimbresViewModel.Song == SongViewModel.Song
                                                   select child)
                {
                    child.Focus();
                    return;
                }


                // Create combi window if not already present.
                var mdiChild = new MdiChild
                {
                    Title       = GenerateSngTimbresWindowTitle(),
                    Content     = new SongTimbresWindow(SongViewModel),
                    MinimizeBox = false,
                    MaximizeBox = false,
                    Width       = Settings.Default.UI_SongWindowWidth == 0 ? 700 : Settings.Default.UI_SongTimbresWindowWidth,
                    Height      = Settings.Default.UI_SongWindowHeight == 0 ? 500 : Settings.Default.UI_SongTimbresWindowHeight,
                    Margin      = new Thickness(0, 0, 0, 0)
                };

                ((SongTimbresWindow)(mdiChild.Content)).MdiChild = mdiChild;
                _mainWindow.Container.Children.Add(mdiChild);
                mdiChild.GotFocus += _mainWindow.MdiGotFocus;
                mdiChild.Closing  += _mainWindow.MdiClosing;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// OpenMessageFileCommandCF
        /// </summary>
        private void OpenMessageFileCommandCF()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return;
            }

            string messageFileName = LST.OpenFileDialog("Cmm Datein (*.cmm)|*.cmm;|Alle Dateien (*.*)|*.*\"");

            if (String.IsNullOrEmpty(messageFileName))
            {
                return;
            }

            ((UserControlTCPMDIChild)tw.Content).MessageList     = LST.LoadList <Message>(messageFileName);
            ((UserControlTCPMDIChild)tw.Content).MessageFileName = messageFileName;
            if (((UserControlTCPMDIChild)tw.Content).MessageList.Count > 0)
            {
                ((UserControlTCPMDIChild)tw.Content).FocusMessageIndex = 0;
                ((UserControlTCPMDIChild)tw.Content).FocusMessage      = ((UserControlTCPMDIChild)tw.Content).MessageList[0];
            }
            _logger.Info(String.Format("Lode MessageFile File {0}", messageFileName));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Main"/> class.
        /// </summary>
        public Main()
        {
            InitializeComponent();
            _original_title = Title;
            Container.Children.CollectionChanged += (o, e) => Menu_RefreshWindows(o, e);
            Container.MdiChildTitleChanged       += Container_MdiChildTitleChanged;

            Container.Children.Add(new MdiChild
            {
                Title = "Empty Window Using Code",
                Icon  = Extensions.MakeIcon(new PackIconOcticons {
                    Kind = PackIconOcticonsKind.GitCompare
                })
            });
            MdiChild mdi = new MdiChild
            {
                Title    = "Window Using Code",
                Width    = 714,
                Height   = 734,
                Position = new Point(300, 80),
                Icon     = Extensions.MakeIcon(new PackIconMaterial {
                    Kind = PackIconMaterialKind.Airplane
                }, Brushes.White)
            };

            mdi.Activated   += Window_Activated;
            mdi.Deactivated += Window_Deactivated;
            mdi.Content      = new ExampleControl(mdi);

            Container.Children.Add(mdi);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// LoadConnectionsCommandCF
        /// </summary>
        private void LoadConnectionsCommandCF()
        {
            double AcParentWindoHeight = ActualHeight;
            double AcParentWindoWidth  = ActualWidth;

            string configFileName = LST.OpenFileDialog("Cmc Datein (*.cmc)|*.cmc;|Alle Dateien (*.*)|*.*\"");

            if (String.IsNullOrEmpty(configFileName))
            {
                return;
            }

            RecentFileList.InsertFile(configFileName);
            Filepath      = configFileName;
            _IsFileLoaded = true;
            _IsFileNamed  = true;

            Connection newConnection = Connection.Load(configFileName);

            _logger.Info(String.Format("Load Connection File {0}", configFileName));

            MdiChild MdiChild = new MdiChild()
            {
                Title   = String.Format("{0} ( )", Path.GetFileName(configFileName)),
                Height  = (AcParentWindoHeight - MainMenu.ActualHeight - MainToolBar.ActualHeight) * 0.6,
                Width   = AcParentWindoWidth * 0.6,
                Content = new UserControlTCPMDIChild(newConnection, this)
            };

            ((UserControlTCPMDIChild)MdiChild.Content).TheMdiChild = MdiChild;
            MainMdiContainer.Children.Add(MdiChild);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// SaveConnectionsCommandCF
        /// </summary>
        private void SaveConnectionsCommandCF()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                _logger.Info("Nothing to save!!");
                return;
            }

            string configFileName = LST.SaveFileDialog("Cmc Datein (*.cmc)|*.cmc;|Alle Dateien (*.*)|*.*\"");

            if (String.IsNullOrEmpty(configFileName))
            {
                return;
            }

            RecentFileList.InsertFile(configFileName);
            Filepath      = configFileName;
            _IsFileLoaded = true;
            _IsFileNamed  = true;

            ((UserControlTCPMDIChild)tw.Content).SetNewConnectionName(Path.GetFileName(configFileName));
            tw.Title = Path.GetFileName(configFileName);
            if (((UserControlTCPMDIChild)tw.Content).IsConnected)
            {
                tw.Title += " (!)";
            }
            else
            {
                tw.Title += " ( )";
            }
            Connection.Save(((UserControlTCPMDIChild)tw.Content).MyConnection, configFileName);
            _logger.Info(String.Format("Save Connection File {0}", configFileName));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// NewConnectionsWindowCommandCF
        /// </summary>
        private void NewConnectionsWindowCommandCF()
        {
            double AcParentWindoHeight = ActualHeight;
            double AcParentWindoWidth  = ActualWidth;

            ConfigNewConnection ConfigNewConnectionDlg = new ConfigNewConnection();

            ConfigNewConnectionDlg.Owner = Window.GetWindow(this);
            var res = ConfigNewConnectionDlg.ShowDialog();

            if (!res.Value)
            {
                return;
            }

            MdiChild MdiChild = new MdiChild()
            {
                Title   = String.Format("New Connection ( )"),
                Height  = (AcParentWindoHeight - MainMenu.ActualHeight - MainToolBar.ActualHeight) * 0.6,
                Width   = AcParentWindoWidth * 0.6,
                Content = new UserControlTCPMDIChild(ConfigNewConnectionDlg.ConnectionObj, this)
            };

            ((UserControlTCPMDIChild)MdiChild.Content).TheMdiChild = MdiChild;
            MainMdiContainer.Children.Add(MdiChild);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// GetTopMDIWindow
        /// </summary>
        /// <returns></returns>
        private MdiChild GetTopMDIWindow()
        {
            MdiChild   tw          = null;
            List <int> iZIndexList = new List <int>();

            if (MainMdiContainer.Children.Count == 0)
            {
                return(null);
            }

            foreach (var w in MainMdiContainer.Children)
            {
                iZIndexList.Add(System.Windows.Controls.Panel.GetZIndex(w));
            }

            //Debug.WriteLine("MDI-Windows ZIndexList:");
            //Debug.Write(String.Join("; ", iZIndexList));
            //Debug.WriteLine("");

            int max = iZIndexList.Max();

            tw = MainMdiContainer.Children[iZIndexList.IndexOf(max)];

            return(tw);
        }
Ejemplo n.º 10
0
        private void miAnniversaire_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MdiChild mdiChild = new MdiChild();

                DataTable dt = sess_emp.AnniversaireAVenir();
                dt.Columns.Add("Jour").DataType = ("string").GetType();
                dt.Columns["Jour"].SetOrdinal(0);

                foreach (DataRow dr in dt.Rows)
                {
                    DateTime date       = DateTime.Parse(dr["DateNaissance"].ToString());
                    string   dateString = date.ToString("dd MMMM", new System.Globalization.CultureInfo("fr-fr"));
                    dr["Jour"] = dateString;
                }

                dt.Columns.Remove("DateNaissance");

                mdiChild.Content =
                    new FenRapport(this.MainMdiContainer, "Anniversaires Proches", dt);
                mdiChild.Title      = "Rapport d'Employés";
                mdiChild.Height     = 400;
                mdiChild.Width      = 600;
                mdiChild.Background = MyGradientBrush.getBackgroundBrush();

                this.MainMdiContainer.Children.Add(mdiChild);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 11
0
        void Menu_RefreshWindows()
        {
            WindowsMenu.Items.Clear();
            MenuItem mi;

            for (int i = 0; i < Container.Children.Count; i++)
            {
                MdiChild child = Container.Children[i];
                mi = new MenuItem {
                    Header = child.Title
                };
                mi.Click += (o, e) => child.Focus();
                WindowsMenu.Items.Add(mi);
            }
            WindowsMenu.Items.Add(new Separator());
            WindowsMenu.Items.Add(mi = new MenuItem {
                Header = "Cascata"
            });
            mi.Click += (o, e) => Container.MdiLayout = MdiLayout.Cascade;
            WindowsMenu.Items.Add(mi = new MenuItem {
                Header = "Horizontal"
            });
            mi.Click += (o, e) => Container.MdiLayout = MdiLayout.TileHorizontal;
            WindowsMenu.Items.Add(mi = new MenuItem {
                Header = "Vertical"
            });
            mi.Click += (o, e) => Container.MdiLayout = MdiLayout.TileVertical;

            WindowsMenu.Items.Add(new Separator());
            WindowsMenu.Items.Add(mi = new MenuItem {
                Header = "Fechar Todas"
            });
            mi.Click += (o, e) => Container.Children.Clear();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// AddNewMessageCommandCF
        /// </summary>
        private void AddNewMessageCommandCF()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return;
            }
            UserControlTCPMDIChild uctmc = GetTopMDIWindow().Content as UserControlTCPMDIChild;

            CreateNewMessage CreateNewMessageDlg = new CreateNewMessage();

            CreateNewMessageDlg.Owner = Window.GetWindow(this);
            var res = CreateNewMessageDlg.ShowDialog();

            if (!res.Value || CreateNewMessageDlg.FocusMessage == null)
            {
                return;
            }

            uctmc.FocusMessage = new Message {
                Content = CreateNewMessageDlg.FocusMessage
            };
            uctmc.MessageList.Add(uctmc.FocusMessage);
        }
Ejemplo n.º 13
0
 private void ShowDesigners()
 {
     try
     {
         //showDummy();
         MdiChild designers = new MdiChild();
         designers.Title = ApplicationTitle + " - Reports Designer";
         ProcessDesigner.frmflxReports flxReports = new ProcessDesigner.frmflxReports(_userInformation, designers, StartDate, EndDate);
         designers.Content     = flxReports;
         designers.Height      = flxReports.Height + 40;
         designers.Width       = flxReports.Width + 20;
         designers.MinimizeBox = true;
         designers.MaximizeBox = true;
         designers.Resizable   = false;
         if (MainMDI.IsFormAlreadyOpen("Reports Designer") == false)
         {
             MainMDI.Container.Children.Add(designers);
         }
         else
         {
             designers = new MdiChild();
             designers = (MdiChild)MainMDI.GetFormAlreadyOpened("Reports Designer");
             MainMDI.SetMDI(designers);
         }
     }
     catch (Exception ex)
     {
         throw ex.LogException();
     }
 }
Ejemplo n.º 14
0
        //Create graph window (MDI child), add graph control to graph window and add graph window the main MDI container.
        private void AddGraphWindow(Point position, int width, int height, string windowTitle, string xAxisLabel, string yAxisLabel)
        {
            //Create new graph window.
            var graphWindow = new MdiChild
            {
                MinHeight   = 200,
                MinWidth    = 400,
                Title       = windowTitle,
                Height      = height,
                Width       = width,
                MinimizeBox = false
            };

            //Create new graph control.
            var graphControl = new GraphControl(_mouseMode, xAxisLabel, yAxisLabel)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Uid = windowTitle
            };

            //Add graphControl to graph window.
            graphWindow.Content = graphControl;

            //Add graphWindow to graph main container.
            Container.Children.Add(graphWindow);
            graphWindow.Position = new Point(position.X, position.Y);
            _graphControls.Add(graphControl);
        }
Ejemplo n.º 15
0
        private void CreateLevelBeginWindow(string message)
        {
            MdiChild BeginningMessageWindow = new MdiChild()
            {
                Width  = StartupWindow.Width + 130,
                Height = StartupWindow.Height
            };

            //Add a stackpanel to hold the following elements
            StackPanel spMessages  = new StackPanel();
            TextBlock  lblMessage1 = new TextBlock()
            {
                Text = message, FontSize = 29, FontFamily = new FontFamily("Kristen ITC"), TextWrapping = TextWrapping.Wrap, Foreground = new SolidColorBrush(Colors.Red)
            };
            TextBlock lblMessage2 = new TextBlock()
            {
                Text = currentPlayer.CurrentLevel.LevelBeginningMessage, FontSize = 20, FontFamily = new FontFamily("Kristen ITC"), TextWrapping = TextWrapping.Wrap, Foreground = new SolidColorBrush(Colors.RosyBrown)
            };
            Button btnGotIt = new Button()
            {
                Content = "Got it!", FontSize = 20, FontFamily = new FontFamily("Kristen ITC"), MaxWidth = 100
            };

            spMessages.Children.Add(lblMessage1);
            spMessages.Children.Add(lblMessage2); spMessages.Children.Add(btnGotIt);
            BeginningMessageWindow.Content = spMessages;
            Container.Children.Add(BeginningMessageWindow);
            BeginningMessageWindow.Position = new Point((SystemParameters.PrimaryScreenWidth / 2 - StartupWindow.Width / 2), SystemParameters.PrimaryScreenHeight / 4 - StartupWindow.Height / 2);
            btnGotIt.Click          += btnGotIt_Click;
            ScoringWindow.Visibility = Visibility.Hidden;
            PlayingWindow.Visibility = Visibility.Hidden;
        }
Ejemplo n.º 16
0
 public static void SetMDI(MdiChild mdiChild)
 {
     try
     {
         int maxZindex = 0;
         for (int i = 0; i < mdiChild.Container.Children.Count; i++)
         {
             int zindex = System.Windows.Controls.Panel.GetZIndex(mdiChild.Container.Children[i]);
             if (zindex > maxZindex)
             {
                 maxZindex = zindex;
             }
             if (mdiChild.Container.Children[i] != mdiChild)
             {
                 mdiChild.Container.Children[i].Focused = false;
             }
             else
             {
                 mdiChild.Focused = true;
             }
         }
         System.Windows.Controls.Panel.SetZIndex(mdiChild, maxZindex + 1);
     }
     catch (Exception ex)
     {
     }
 }
        public void DataGridResult_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                DataRowView    selecteditem = (DataRowView)((System.Windows.Controls.DataGrid)(sender)).CurrentItem;
                DataGridColumn column       = ((System.Windows.Controls.DataGrid)(sender)).CurrentColumn;
                if (selecteditem != null && column != null)
                {
                    string columnName = column.SortMemberPath;
                    if (columnName == "PART_NO")
                    {
                        Progress.Start();
                        partno = selecteditem["PART_NO"].ToString().Trim();
                        MdiChild frmProductInformationChild = new MdiChild
                        {
                            Title       = ApplicationTitle + " - Product Master",
                            MaximizeBox = false,
                            MinimizeBox = false
                        };

                        ProcessDesigner.frmProductInformation productInformation = new ProcessDesigner.frmProductInformation(_userInformation,
                                                                                                                             frmProductInformationChild, selecteditem["IDPK"].ToString().ToIntValue(), OperationMode.Edit);
                        frmProductInformationChild.Content = productInformation;
                        frmProductInformationChild.Height  = productInformation.Height + 50;
                        frmProductInformationChild.Width   = productInformation.Width + 20;
                        MainMDI.Container.Children.Add(frmProductInformationChild);
                        Progress.End();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Produces the next generation of individuals in a new field.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void newButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (currSpeakerButton != null)
                {
                    currSpeakerButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                }

                List <byte> selected     = GetSelectedGenomes();
                List <byte> nonPreserved = GetNonPreservedGenomes();
                MainWindow.pop.NextGeneration(individuals, nonPreserved, selected);

                FieldWindow fw = new FieldWindow(MainWindow.pop.Genomes);
                fw.Tag = (int)this.Tag + 1;
                ((Button)fw.fieldGrid.FindName("thisButton")).Name = "thisButton_" + MainWindow.fieldCount + "_" + fw.Tag;

                MdiChild child = new MdiChild();
                child.Name  = MainWindow.fieldIdentifier;
                child.Title = "Field " + MainWindow.fieldCount + "." + fw.Tag;
                MainWindow.mdiChildIdentifier.Add(MainWindow.fieldCount + "_" + fw.Tag);
                child.Width      = double.NaN;
                child.Height     = double.NaN;
                child.Background = Brushes.White;
                child.Content    = fw;
                child.ToolTip    = child.Title;
                windowContainer.Children.Add(child);

                AddFieldWindowGotFocusEventHandler(child);
                AddFieldWindowClosingEventHandler(child);
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// EditMessageCommandCF
        /// </summary>
        private void EditMessageCommandCF()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return;
            }
            UserControlTCPMDIChild uctmc = GetTopMDIWindow().Content as UserControlTCPMDIChild;

            EditMessages EditMessagesDlg = new EditMessages(((UserControlTCPMDIChild)tw.Content).SendMessage);

            EditMessagesDlg.SelectedTabItemsIndex = uctmc.FocusMessageIndex;
            EditMessagesDlg.MessagesToEdit        = ((UserControlTCPMDIChild)tw.Content).MessageList;
            EditMessagesDlg.Owner = Window.GetWindow(this);
            var res = EditMessagesDlg.ShowDialog();

            if (!res.Value)
            {
                return;
            }

            uctmc.FocusMessageIndex = EditMessagesDlg.SelectedTabItemsIndex;
            uctmc.FocusMessage      = EditMessagesDlg.MessagesToEdit[EditMessagesDlg.SelectedTabItemsIndex];
        }
Ejemplo n.º 20
0
 public ExampleControl(MdiChild _mdi)
 {
     InitializeComponent();
     MDI          = _mdi;
     Width        = double.NaN;
     Height       = double.NaN;
     MDI.Closing += ExampleControl_Unloaded;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Note: Not used.
        /// </summary>
        // ReSharper disable MemberCanBePrivate.Global
        public void CloseWindow()
        {
            MdiChild.Close();

            Settings.Default.UI_SongWindowWidth  = (int)MdiChild.Width;
            Settings.Default.UI_SongWindowHeight = (int)MdiChild.Height;
            Settings.Default.Save();
        }
Ejemplo n.º 22
0
 Shell(string shellId, MdiChild shellWindow)
 {
     IsClosing       = false;
     ShellId         = shellId;
     ShellWindow     = shellWindow;
     OpenWindowState = WindowState.Normal;
     MainControl     = null;
     Interrupter     = new InterruptSource();
 }
Ejemplo n.º 23
0
        /// <summary>
        /// SendCommandCF
        /// </summary>
        private void SendCommandCF()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return;
            }
            ((UserControlTCPMDIChild)tw.Content).SendMessage(((UserControlTCPMDIChild)tw.Content).FocusMessage.Content);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// DeleteAllCommandCF
        /// </summary>
        private void DeleteAllCommandCF()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return;
            }
            ((UserControlTCPMDIChild)tw.Content).DeleteAllMessages();
        }
Ejemplo n.º 25
0
        public void AddChild(Behaviors.Bot bot)
        {
            var child = new MdiChild();

            child.Title   = "Bot";
            child.Content = new BotControl(bot);

            child.Closed += OnChildClosed;

            MdiContainer.Children.Add(child);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// CanOpenMessageFileCommand
        /// </summary>
        /// <returns></returns>
        private bool CanOpenMessageFileCommand()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return(false);
            }
            UserControlTCPMDIChild uctmc = GetTopMDIWindow().Content as UserControlTCPMDIChild;

            return(uctmc.IsConnected);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// CanSaveMessageFileAsCommand
        /// </summary>
        /// <returns></returns>
        private bool CanSaveMessageFileAsCommand()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return(false);
            }
            UserControlTCPMDIChild uctmc = GetTopMDIWindow().Content as UserControlTCPMDIChild;

            return(uctmc.IsConnected && uctmc.MessageList.Count > 0);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// CanDeleteAllCommand
        /// </summary>
        /// <returns></returns>
        private bool CanDeleteAllCommand()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return(false);
            }
            UserControlTCPMDIChild uctmc = GetTopMDIWindow().Content as UserControlTCPMDIChild;

            return(uctmc.IsConnected && uctmc.GetAllMessages().Count > 0);
        }
Ejemplo n.º 29
0
        private void openTab(TsiFileViewModel vm)
        {
            var mdiChild = new MdiChild <TsiFileView, TsiFileViewModel>(new TsiFileView(), vm, vm.Title + (vm.IsChanged ? "*" : ""));

            // bind viewmodel's title to MDI child title
            vm.PropertyChanged += (s, e) => { if (e.PropertyName == "Title" || e.PropertyName == "IsChanged")
                                              {
                                                  mdiChild.Title = vm.Title + (vm.IsChanged ? "*" : "");
                                              }
                                              refreshAppTitle(); };
            _mdiContainer.AddMdiChild(mdiChild);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// CanAddNewMessageCommand
        /// </summary>
        /// <returns></returns>
        private bool CanAddNewMessageCommand()
        {
            MdiChild tw = GetTopMDIWindow();

            if (tw == null)
            {
                return(false);
            }
            UserControlTCPMDIChild uctmc = GetTopMDIWindow().Content as UserControlTCPMDIChild;

            _logger.Debug(String.Format("#3 {0} IsConnected={1} ThreadId={2} hashcode={3}", LST.GetCurrentMethod(), uctmc.IsConnected, System.Threading.Thread.CurrentThread.ManagedThreadId, uctmc.GetHashCode()));
            return(uctmc.IsConnected);
        }
Ejemplo n.º 31
0
		public void MdiClosingClosedEvent ()
		{
			Form f = new Form ();
			f.IsMdiContainer = true;
			
			MdiChild mdi = new MdiChild ();
			mdi.can_close = false;
			mdi.MdiParent = f;

			f.Closing += new CancelEventHandler (f_Closing);
			f.Closed += new EventHandler (f_Closed);
			mdi.Closing += new CancelEventHandler (mdi_Closing);
			mdi.Closed += new EventHandler (mdi_Closed);

#if NET_2_0
			f.FormClosing += new FormClosingEventHandler (f_FormClosing);
			f.FormClosed += new FormClosedEventHandler (f_FormClosed);
			mdi.FormClosing += new FormClosingEventHandler (mdi_FormClosing);
			mdi.FormClosed += new FormClosedEventHandler (mdi_FormClosed);
#endif

			f.Show ();
			mdi.Show ();
			
			events_fired = string.Empty;
			
			f.Close ();
			
#if NET_2_0
			Assert.AreEqual ("Child.Closing: True, Child.FormClosing: True, Parent.Closing: True, Parent.FormClosing: True, ", events_fired, "A1-2.0");
#else
			Assert.AreEqual ("Child.Closing: True, Parent.Closing: True, ", events_fired, "A1-1.1");
#endif

			events_fired = string.Empty;
			mdi.can_close = true;
			f.Close ();
			
#if NET_2_0
			Assert.AreEqual ("Child.Closing: False, Child.FormClosing: False, Parent.Closing: False, Parent.FormClosing: False, Child.Closed, Child.FormClosed, Parent.Closed, Parent.FormClosed, ", events_fired, "A2-2.0");
#else
			Assert.AreEqual ("Child.Closing: False, Parent.Closing: False, Child.Closed, Parent.Closed, ", events_fired, "A2-1.1");
#endif

			f.Dispose ();
		}