Пример #1
0
        private void NetworkDiagramButton_Click(object sender, RoutedEventArgs e)
        {
            // Optionally, specify a maximum indentation level to consider when generating network items as a parameter to the GetNetworkDiagramItems method call.
            networkDiagramItems = GanttChartDataGrid.GetNetworkDiagramItems();
            var networkDiagramView = new DlhSoft.Windows.Controls.Pert.NetworkDiagramView {
                Items = networkDiagramItems
            };
            ChildWindow networkDiagramWindow =
                new ChildWindow
            {
                Title   = "Network Diagram", Width = 960, Height = 600,
                Content = networkDiagramView
            };

            networkDiagramView.AsyncPresentationCompleted += delegate(object senderCompleted, EventArgs eCompleted)
            {
                // Optionally, reposition start and finish milestones between the first and second rows of the view.
                networkDiagramView.RepositionEnds();
                // Optionally, highlight the critical path.
                Brush redBrush = new SolidColorBrush(Colors.Red);
                foreach (var item in networkDiagramView.GetCriticalItems())
                {
                    DlhSoft.Windows.Controls.Pert.NetworkDiagramView.SetShapeStroke(item, redBrush);
                }
                foreach (var predecessorItem in networkDiagramView.GetCriticalDependencies())
                {
                    DlhSoft.Windows.Controls.Pert.NetworkDiagramView.SetDependencyLineStroke(predecessorItem, redBrush);
                }
            };
            networkDiagramWindow.Closed += NetworkDiagramWindow_Closed;
            networkDiagramWindow.Show();
        }
        private void btnEmployeeID_DefaultButtonClick(object sender, RoutedEventArgs e)
        {
            var WbClnt = new WebClient();//Tao WebClient

            WbClnt.OpenReadCompleted += (a, b) =>
            {
                if (b.Error == null)
                {
                    AssemblyPart assmbpart = new AssemblyPart();
                    Assembly     assembly  = assmbpart.Load(b.Result);
                    Object       Obj       = assembly.CreateInstance("HPA.Common" + "." + "Find"); //Truy xuat file dll
                    if (Obj != null)                                                               //Neu co file dll thi tao ChildWindow
                    {
                        ChildWindow child = (ChildWindow)assembly.CreateInstance("HPA.Common" + "." + "Find");
                        child.Closed -= GetEMPID;//nhan ket qua tra ve tu childwindow
                        child.Closed += GetEMPID;
                        child.Show();
                        //if (child.DialogResult==true)
                        //{ txtMNV.Text = EMPID; }
                        //else { txtMNV.Text = "null"; }
                    }
                    else
                    {
                        MessageBox.Show("Page not exist");
                    }                                          //Khong ton tai page thi bao loi
                }
                else
                {
                    MessageBox.Show("Page not exist");
                }                                          //Khong ton tai file dll thi bao loi
            };
            WbClnt.OpenReadAsync(new Uri("http://localhost:10511/Control/" + "HPA.Common" + ".dll", UriKind.Absolute));
        }
Пример #3
0
        void TLYC1_TileClick(object sender, TileClickEventArgs e)
        {
            ma       = e.Tile.Name.ToString();
            tentitle = e.Tile.Header.ToString();
            var WbClnt = new WebClient();//Tao WebClient

            WbClnt.OpenReadCompleted += (a, b) =>
            {
                if (b.Error == null)
                {
                    AssemblyPart assmbpart = new AssemblyPart();
                    Assembly     assembly  = assmbpart.Load(b.Result);
                    Object       Obj       = assembly.CreateInstance("HPA.Announcement" + "." + "ViewAnnouncement"); //Truy xuat file dll
                    if (Obj != null)                                                                                 //Neu co file dll thi tao ChildWindow
                    {
                        ChildWindow child = (ChildWindow)assembly.CreateInstance("HPA.Announcement" + "." + "ViewAnnouncement");
                        child.Width  = (double)HtmlPage.Window.Eval("screen.availWidth") - 100;
                        child.Height = (double)HtmlPage.Window.Eval("screen.availHeight") - 100;
                        child.Show();
                    }
                    else
                    {
                        MessageBox.Show("Page not exist");
                    }                                          //Khong ton tai page thi bao loi
                }
                else
                {
                    MessageBox.Show("Page not exist");
                }                                          //Khong ton tai file dll thi bao loi
            };
            WbClnt.OpenReadAsync(new Uri("http://localhost:10511/Control/" + "HPA.Announcement" + ".dll", UriKind.Absolute));
        }
Пример #4
0
        private void AdvancedHeatMapProperties_Click(object sender, RoutedEventArgs e)
        {
            ConfigurableHeatMapLayer layerInfo = this.DataContext as ConfigurableHeatMapLayer;

            if (layerInfo == null)
            {
                return;
            }
            (sender as Button).IsEnabled = false;
            if (heatMapWindow == null)
            {
                heatMapWindow = new ChildWindow();
                //heatMapWindow.ResizeMode = ResizeMode.NoResize;
                TextBlock title = new TextBlock {
                    Foreground = new SolidColorBrush(Colors.White), FontSize = 12, FontWeight = FontWeights.Bold, Text = "Advanced Properties"
                };
                heatMapWindow.Title = title;
                double dialogWidth  = 325;
                double dialogHeight = 268;
                heatMapWindow.Height = dialogHeight;
                heatMapWindow.Width  = dialogWidth;

                //heatMapWindow.HorizontalOffset = (Application.Current.RootVisual.RenderSize.Width - heatMapWindow.Width) / 2;
                //heatMapWindow.VerticalOffset = (Application.Current.RootVisual.RenderSize.Height - heatMapWindow.Height) / 2;

                configWindow                = new HeatMapPropertiesConfigWindow();
                configWindow.OkClicked     += (o, args) => { heatMapWindow.DialogResult = true; };
                configWindow.CancelClicked += (o, args) =>
                {
                    heatMapWindow.DialogResult = false; // automatically calls close
                };
                configWindow.GradientStopsChanged += (o, args) =>
                {
                    //layerInfo.HeatMapInfo.Gradients = args.GradientStops;
                };

                heatMapWindow.Closed += (o, args) =>
                {
                    (sender as Button).IsEnabled = true;
                    if (heatMapWindow.DialogResult != true) // && !heatMapWindow.IsAppExit)
                    {
                        restoreHeatMapProperties();
                    }
                };
            }
            //if (layerInfo.HeatMapInfo == null)
            //    layerInfo.HeatMapInfo = new HeatMapInfo();
            //currentHeatMapInfo = layerInfo.HeatMapInfo != null ? layerInfo.HeatMapInfo.Clone() : new HeatMapInfo();

            configWindow.DataContext = layerInfo;

            //Grid g = new Grid() { Width = 310, Height = 245-20 };
            //g.Children.Add(configWindow);
            //(Application.Current.RootVisual as Grid).Children.Add(g);

            heatMapWindow.Content      = configWindow;
            heatMapWindow.DialogResult = null;
            //heatMapWindow.ShowWindow(false);
            heatMapWindow.Show();
        }
Пример #5
0
        public static ChildWindow PopupMessage(string title, string message)
        {
            if (CurrentPopup != null)
            {
                return(null);
            }

            var msgBox = new ChildWindow();

            CurrentPopup = msgBox;

            msgBox.Style       = System.Windows.Application.Current.Resources["PopupMessageWindow"] as Style;
            msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC));
            msgBox.Title       = title;

            msgBox.MaxWidth = Application.Current.Host.Content.ActualWidth * 0.5;

            msgBox.Content = new TextBlock()
            {
                Text = message, Margin = new Thickness(20), Foreground = new SolidColorBrush(Colors.White), FontSize = 14
            };
            msgBox.IsTabStop = true;
            msgBox.Show();
            msgBox.Focus();

            _currentWindow = msgBox;
            PopupManager.CloseActivePopup();
            return(msgBox);
        }
        private void CreateChildPage(string asb, string cls)
        {
            var WbClnt = new WebClient();//Tao WebClient

            WbClnt.OpenReadCompleted += (a, b) =>
            {
                if (b.Error == null)
                {
                    AssemblyPart assmbpart = new AssemblyPart();
                    Assembly     assembly  = assmbpart.Load(b.Result);
                    Object       Obj       = assembly.CreateInstance(asb + "." + cls); //Truy xuat file dll
                    if (Obj != null)                                                   //Neu co file dll thi tao ChildWindow
                    {
                        ChildWindow child = (ChildWindow)assembly.CreateInstance(asb + "." + cls);
                        child.Width  = (double)HtmlPage.Window.Eval("screen.availWidth") - 100;
                        child.Height = (double)HtmlPage.Window.Eval("screen.availHeight") - 100;
                        child.Show();
                    }
                    else
                    {
                        MessageBox.Show("Page not exist");
                    }                                          //Khong ton tai page thi bao loi
                }
                else
                {
                    MessageBox.Show("Page not exist");
                }                                          //Khong ton tai file dll thi bao loi
            };
            WbClnt.OpenReadAsync(new Uri("http://localhost:10511/Control/" + asb + ".dll", UriKind.Absolute));
        }
Пример #7
0
 private void Creer()
 {
     try
     {
         ChildWindow form = null;
         try
         {
             _formeName = "UcInitialisation";
             if (!string.IsNullOrEmpty(_formeName))
             {
                 form = ContextMenuManagement.CreateChildWindow(NameSpace + _formeName, Galatee.Silverlight.Resources.Devis.Languages.ttlCreationDevis, SessionObject.ExecMode.Creation);
             }
             if (form != null)
             {
                 form.Closed += new EventHandler(form_Closed);
                 form.Show();
             }
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #8
0
        private void PertChartButton_Click(object sender, RoutedEventArgs e)
        {
            // Optionally, specify a maximum indentation level to consider when generating PERT items as a parameter to the GetPertChartItems method call.
            pertChartItems = GanttChartDataGrid.GetPertChartItems();
            var pertChartView = new DlhSoft.Windows.Controls.Pert.PertChartView {
                Items = pertChartItems, PredecessorToolTipTemplate = Resources["PertChartPredecessorToolTipTemplate"] as DataTemplate
            };
            ChildWindow pertChartWindow =
                new ChildWindow
            {
                Title   = "PERT Chart", Width = 640, Height = 480,
                Content = pertChartView
            };

            pertChartView.AsyncPresentationCompleted += delegate(object senderCompleted, EventArgs eCompleted)
            {
                // Optionally, highlight the critical path.
                Brush redBrush = new SolidColorBrush(Colors.Red);
                foreach (var item in pertChartView.GetCriticalItems())
                {
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetShapeStroke(item, redBrush);
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetTextForeground(item, redBrush);
                }
                foreach (var predecessorItem in pertChartView.GetCriticalDependencies())
                {
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyLineStroke(predecessorItem, redBrush);
                    DlhSoft.Windows.Controls.Pert.PertChartView.SetDependencyTextForeground(predecessorItem, redBrush);
                }
            };
            pertChartWindow.Closed += PertChartWindow_Closed;
            pertChartWindow.Show();
        }
        private void SetWithOverlay()
        {
            var content = new TextBlock
            {
                Margin     = new Thickness(30, 30, 30, 30),
                Text       = "Touch my Overlay to close me.\n\nI have no Silverlight's behaviors.",
                FontWeight = FontWeights.Bold,
            };

            _withOverlay = new ChildWindowWithClosingOverlay
            {
                // !!! Custom settings.
                DisabledClosingOverlay    = false,
                RightMouseButtonClosingTo = false,


                Title   = "ChildWindow closed by Overlay",
                Content = content,

                OverlayBrush   = new SolidColorBrush(Colors.Transparent),
                OverlayOpacity = 0.4,
                HasCloseButton = false,
            };
            _withOverlay.Show();
        }
Пример #10
0
        private void ShowSequences(IList <string> items)
        {
            string tblTxt = "";
            string facet  = "";
            int    c      = 0;

            foreach (string item in items)
            {
                PivotItem pivotItem     = MainPivotViewer.GetItem(item);
                string    queryName     = "";
                string    querySequence = "";
                foreach (KeyValuePair <string, IList <string> > kvp in pivotItem.Facets)
                {
                    if (kvp.Key == "QueryName")
                    {
                        string   val  = String.Join(", ", ((List <string>)kvp.Value).ToArray());
                        string[] vals = Regex.Split(val, "[|]{2}");
                        if (vals.Length > 1)
                        {
                            facet = vals[1];
                        }
                        else
                        {
                            facet = vals[0];
                        }
                        queryName = facet;
                    }
                    if (kvp.Key == "QuerySequence")
                    {
                        string   val  = String.Join(", ", ((List <string>)kvp.Value).ToArray());
                        string[] vals = Regex.Split(val, "[|]{2}");
                        if (vals.Length > 1)
                        {
                            facet = vals[1];
                        }
                        else
                        {
                            facet = vals[0];
                        }
                        querySequence = facet;
                    }
                }
                tblTxt += ">" + queryName + "\n" + querySequence + "\n";
                c      += 1;
            }
            ChildWindow childWin = new ChildWindow();

            childWin.Width  = 800;
            childWin.Height = 400;
            childWin.Title  = "BL!P Query Sequences in FASTA Format";
            TextBox tb = new TextBox();

            tb.Text          = tblTxt;
            childWin.Content = tb;
            tb.IsReadOnly    = true;
            tb.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            tb.VerticalScrollBarVisibility   = ScrollBarVisibility.Visible;
            childWin.Show();
        }
Пример #11
0
        /// <summary>
        /// This method displays ChildWindow associated with the given key
        /// calling code is not blocked, and will not wait on the ChildWindow being
        /// closed. So this should only be used when there is no code dependant on
        /// the ChildWindows DialogResult. If you want to use the result of the ChildWindow
        /// being shown you can should create a callback delegate for the completedProc
        /// </summary>
        /// <param name="key">Key previously registered with the UI controller.</param>
        /// <param name="state">Object state to associate with the dialog</param>
        /// <param name="completedProc">Callback used when UI closes (may be null)</param>
        public void Show(string key, object state, EventHandler <UICompletedEventArgs> completedProc)
        {
            ChildWindow win = CreateChildWindow(key, state, completedProc);

            if (win != null)
            {
                win.Show();
            }
        }
Пример #12
0
        public void Show(object content)
        {
            var window = new ChildWindow();

            window.Style          = Application.Current.Resources["ChildWindowStyle"] as Style;
            window.HasCloseButton = false;
            window.Content        = content;
            window.Show();
        }
Пример #13
0
        private void ShowItemTable(IList <string> items)
        {
            string tblTxt = "";
            string facet  = "";
            int    c      = 0;

            foreach (string item in items)
            {
                PivotItem pivotItem = MainPivotViewer.GetItem(item);
                if (c == 0)
                {
                    foreach (KeyValuePair <string, IList <string> > kvp in pivotItem.Facets)
                    {
                        if (validFacet(kvp.Key))
                        {
                            tblTxt += kvp.Key + "\t";
                        }
                    }
                    tblTxt += "\n";
                }

                foreach (KeyValuePair <string, IList <string> > kvp in pivotItem.Facets)
                {
                    if (validFacet(kvp.Key))
                    {
                        string   val  = String.Join(", ", ((List <string>)kvp.Value).ToArray());
                        string[] vals = Regex.Split(val, "[|]{2}");
                        if (vals.Length > 1)
                        {
                            facet = vals[1];
                        }
                        else
                        {
                            facet = vals[0];
                        }
                        tblTxt += facet + "\t";
                    }
                }
                tblTxt += "\n";
                c      += 1;
            }

            ChildWindow childWin = new ChildWindow();

            childWin.Width  = 800;
            childWin.Height = 400;
            childWin.Title  = "BL!P Output in Tablular Format";
            TextBox tb = new TextBox();

            tb.Text          = tblTxt;
            childWin.Content = tb;
            tb.IsReadOnly    = true;
            tb.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            tb.VerticalScrollBarVisibility   = ScrollBarVisibility.Visible;
            childWin.Show();
        }
Пример #14
0
    public static void ShowChildWindow(string title, ChildWindowUserControl userControl)
    {
        ChildWindow cw = new ChildWindow()
        {
            Title = title
        };

        cw.Content = userControl;
        cw.Show();
    }
        public static void ShowChildWindow(UIElement content)
        {
            var childWindow = new ChildWindow()
            {
                Content = content,
                Style   = (Style)App.Current.Resources["ViewMoreChildWindow_Style"]
            };

            childWindow.Show();
        }
Пример #16
0
        public void OpenMarket(string epic)
        {
            var window = new ChildWindow();

            window.DataContext = new MarketViewModel(this, epic);

            window.Show();

            _childWindows.Add(window);
        }
Пример #17
0
 private void LoginWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (this.DialogResult == true && (this.nameBox.Text == string.Empty || this.passwordBox.Password == string.Empty))
     {
         e.Cancel = true;
         ChildWindow cw = new ChildWindow();
         cw.Content = "Please Enter your name and password or click Cancel.";
         cw.Show();
     }
 }
Пример #18
0
        private void OnGridRowLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            TimeSpan t = DateTime.Now.TimeOfDay;

            if (ArchiveFlowGrid.Tag != null)
            {
                var oldT = (TimeSpan)ArchiveFlowGrid.Tag;
                if ((t - oldT) < TimeSpan.FromMilliseconds(300))
                {
                    var flow = ArchiveFlowGrid.SelectedItem as ArchiveWorkflow;
                    if (flow != null)
                    {
                        if (NavigationService != null)
                        {
                            NavigationService.Navigate(
                                new Uri(string.Format("Req/EditApplication?FlowId={0}", flow.FlowId), UriKind.Relative));
                        }
                        else
                        {
                            BusyIndicator1.IsBusy      = true;
                            BusyIndicator1.BusyContent = "正在读取流程信息...";
                            flowContext.GetArchiveWorkflow(flow.FlowId, obj =>
                            {
                                BusyIndicator1.IsBusy = false;
                                if (Utility.Utility.CheckInvokeOperation(obj))
                                {
                                    var child = new ChildWindow {
                                        Title = "编辑流程信息"
                                    };
                                    child.Background = Application.Current.Resources["ControlBackgroundAltBrush"] as Brush;
                                    var doc          = obj.Value.Files[0].DocumentInfo;
                                    var editWindow   = new EditApplication
                                    {
                                        OrgId       = doc.OrganizationId,
                                        FolderId    = doc.FolderId,
                                        ArchiveFlow = obj.Value,
                                        Margin      = new Thickness(0, 0, 0, 20)
                                    };
                                    child.Content = editWindow;
                                    child.Closed += (oo, ee) =>
                                    {
                                        if (editWindow.ArchiveFlow.Status == AuditStatus.Auditing && NavigationService != null)
                                        {
                                            NavigationService.Navigate(new Uri("Req/Auditing", UriKind.Relative));
                                        }
                                    };
                                    child.Show();
                                }
                            }, null);
                        }
                    }
                }
            }
            ArchiveFlowGrid.Tag = t;
        }
Пример #19
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            ChildWindow chol = new ChildWindow();

            chol.Height = 2400;
            chol.Width  = 2300;
            //SL_Project_UI.MainPage mp = new SL_Project_UI.MainPage();
            //mp.Visibility = Visibility.Collapsed;
            chol.Show();
        }
 private void ChildWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (this.DialogResult == true &&
         (this.NaamBox.Text == string.Empty || this.passwordBox.Password == string.Empty))
     {
         e.Cancel = true;
         ChildWindow cw = new ChildWindow();
         cw.Content = "Geef uw login naam en wachtwoord in, of druk op annuleer.";
         cw.Show();
     }
 }
Пример #21
0
 public void INTERNAL_WorkAroundFirefoxDisappearingUI() //todo: move this method to the "PublicAPI" folder?
 {
     // Work around an issue on Firefox where the UI disappears if the window is resized and on some other occasions:
     if (_childWindowForWorkaroundFireFoxIssue == null) // Avoids entering multiple times on a single resize.
     {
         _childWindowForWorkaroundFireFoxIssue = new ChildWindow()
         {
             Opacity = 0
         };
         _childWindowForWorkaroundFireFoxIssue.Show();
         _timerForWorkaroundFireFoxIssue.Start();
     }
 }
Пример #22
0
        void _configButton_Click(object sender, RoutedEventArgs e)
        {
            ChildWindow window = new ChildWindow();

            window.FontSize = 12;
            window.Title    = Resource.ColumnsV2_Title;
            var colselector = new CustomizeColumns();

            colselector.Container  = window;
            colselector.OwningGrid = this.OwningGrid;
            window.Content         = colselector;
            window.Show();
        }
Пример #23
0
        void btnSelectDateTime_Click(object sender, RoutedEventArgs e)
        {
            StackPanel pnl = new StackPanel();

            pnl.Orientation = Orientation.Horizontal;

            //InnerTimePicker.Width = 50;
            //StackPanel spSpliter = new StackPanel();
            //spSpliter.Width = 5;
            //InnerDatePicker = new SmtDatePicker();
            //InnerDatePicker.Style = Application.Current.Resources["DatePickerStyle"] as Style;
            //InnerDatePicker.Margin = new Thickness(0, 0, 5, 0);
            //InnerDatePicker.MinWidth = 110;
            InnerDatePicker = new Calendar();
            //InnerDatePicker.Style = Application.Current.Resources["DatePickerStyle"] as Style;
            InnerDatePicker.Margin       = new Thickness(0, 0, 5, 0);
            InnerDatePicker.SelectedDate = DateTime.Now;
            //InnerDatePicker.MinWidth = 110;

            InnerTimePicker           = new ListTimePickerPopup();
            InnerTimePicker.Value     = DateTime.Parse("8:30");
            InnerTimePicker.Margin    = new Thickness(0, 0, 0, 0);
            InnerTimePicker.MinWidth  = 170;
            InnerTimePicker.MinHeight = 155;

            Button btnClose = new Button();

            btnClose.Style           = Application.Current.Resources["CommonButtonStyle"] as Style;
            btnClose.BorderThickness = new Thickness(1);
            btnClose.Click          += new RoutedEventHandler(btnClose_Click);
            btnClose.MinWidth        = 30;
            btnClose.Content         = "确定";



            pnl.Children.Add(InnerDatePicker);
            //pnl.Children.Add(spSpliter);
            pnl.Children.Add(InnerTimePicker);
            pnl.Children.Add(btnClose);
            //this.Content = pnl;
            EndUpdate();

            windowSelectdateTime.Content = pnl;

            double browserHeight = this.txtDateTime.ActualHeight;
            double browserWidth  = this.txtDateTime.ActualWidth;

            windowSelectdateTime.Margin = new Thickness(browserWidth, browserHeight, 0, 0);
            windowSelectdateTime.Show();
            windowSelectdateTime.Loaded += new RoutedEventHandler(windowSelectdateTime_Loaded);
        }
Пример #24
0
        private void LogoutTimerTick(object sender, EventArgs e)
        {
            (( DispatcherTimer )sender).Stop();

            // The main logout time has expired. Show the log out warning prompt.
            LogOutWarning         = new LogOutWarningView(response.WarningTimeOutIntervalSeconds);
            LogOutWarning.Closed += LogOutWarningClosed;
            LogOutWarning.Show();

            // Start the warning timer.
            _warningLogoutTimer.Interval = TimeSpan.FromSeconds(response.WarningTimeOutIntervalSeconds);
            _warningLogoutTimer.Tick    += WarningLogoutTimerTick;
            _warningLogoutTimer.Start();
        }
Пример #25
0
        private void BottomButton_2_Click(object sender, RoutedEventArgs e)
        {
            // 라이브러리 참고용
            var childWindow = new ChildWindow();

            childWindow.Width   = 200;
            childWindow.Height  = 160;
            childWindow.Content = "World";

            this.canvas.Children.Add(childWindow);

            childWindow.Show();
            childWindow.IsModal = true;
        }
Пример #26
0
        public void ShowWindow(UIElement content, Rect bounds, string caption, bool modal)
        {
            ChildWindow cw = new ChildWindow();

            cw.Width   = bounds.Width;
            cw.Height  = bounds.Height;
            cw.Left    = bounds.Left;
            cw.Top     = bounds.Top;
            cw.Caption = caption;
            cw.Content = content;
            cw.IsModal = modal;
            Wnx.Children.Add(cw);
            cw.Show();
        }
        private void MeasurementLogGrid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            MeasurementLogEntry entry = e.Row.DataContext as MeasurementLogEntry;

            // If this entry has a valid calculator associated then change the TextBlock to a HyperlinkButton
            // that when clicked will use the Acivator object to dynamically create the appropriate calculator

            if (entry.Measurement.Calculator != null)
            {
                TextBlock measurementName = MeasurementLogGrid.Columns[0].GetCellContent(e.Row) as TextBlock;

                if (measurementName != null)
                {
                    DataGridCell    cell           = measurementName.Parent as DataGridCell;
                    HyperlinkButton calculatorLink = new HyperlinkButton();

                    calculatorLink.Content             = entry.Measurement.measurement_name;
                    calculatorLink.Margin              = new Thickness(5);
                    calculatorLink.HorizontalAlignment = HorizontalAlignment.Center;
                    calculatorLink.Click += (s, ev) =>
                    {
                        // Create an instance of the calculator using IMeasurementCalculator interface so that we have
                        // access to the calculated value and can update the selected row value

                        ChildWindow            modalWindow = new ChildWindow();
                        IMeasurementCalculator calc        = Activator.CreateInstance(Type.GetType(String.Format("FitnessTrackerPlus.Views.Measurement.Calculators.{0}",
                                                                                                                 entry.Measurement.Calculator.type_name))) as IMeasurementCalculator;

                        calc.CalculationCancelled += (se, eve) => { modalWindow.Close(); };
                        calc.CalculationComplete  += (se, eve) =>
                        {
                            modalWindow.Close();

                            entry.value = calc.CalculatedValue;
                            context.SubmitChanges();
                        };

                        modalWindow.Title   = String.Format("{0} Calculator", entry.Measurement.measurement_name);
                        modalWindow.Content = calc;
                        modalWindow.Show();
                    };

                    // Repace the TextBlock with the HyperlinkButton control

                    cell.Content = calculatorLink;
                }
            }
        }
Пример #28
0
 void button_Click(object sender, RoutedEventArgs e)
 {
     if (Property.Value != null)
     {
         var childWindow = new ChildWindow()
         {
             Title = Property.Value.ToString()
         };
         childWindow.Content = new PropertyGrid()
         {
             SelectedObject = Property.Value, MinWidth = 300, MinHeight = 400
         };
         childWindow.Closed += new EventHandler(childWindow_Closed);
         childWindow.Show();
     }
 }
Пример #29
0
        /// <summary>
        /// Renders this view.
        /// </summary>
        public override void Render()
        {
            var dispatcher = ControllerContext.Request.Navigator.Dispatcher;

            dispatcher.Dispatch(
                delegate
            {
                TraceSources.MagellanSource.TraceInformation("The WindowViewEngine is instantiating the window '{0}'.", _type);

                // Prepare the window
                RenderedInstance = (ChildWindow)_viewActivator.Instantiate(_type);
                WireModelToView(RenderedInstance);

                TraceSources.MagellanSource.TraceVerbose("The ChildWindowViewEngine is rendering the window '{0}' as a dialog.", _type);
                RenderedInstance.Show();
            });
        }
Пример #30
0
        public static ChildWindow PopupMessage(string title, string message, string closeButtonLabel, bool closeWindow)
        {
            if (CurrentPopup != null)
            {
                return(null);
            }

            var msgBox = new ChildWindow();

            CurrentPopup = msgBox;

            msgBox.Style       = Application.Current.Resources["PopupMessageWindow"] as Style;
            msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC));
            msgBox.Title       = title;
            msgBox.MaxWidth    = Application.Current.Host.Content.ActualWidth * 0.5;

            StackPanel content = new StackPanel();

            content.Children.Add(new TextBlock()
            {
                Text = message, Margin = new Thickness(20), Foreground = new SolidColorBrush(Colors.White), FontSize = 14, HorizontalAlignment = HorizontalAlignment.Center
            });

            Button closeButton = new Button {
                Content = closeButtonLabel, FontSize = 14, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(20)
            };

            closeButton.Click += (s, o) =>
            {
                msgBox.Close();
                if (closeWindow)
                {
                    BrowserWindow.Close();
                }
            };
            content.Children.Add(closeButton);
            msgBox.Content   = content;
            msgBox.IsTabStop = true;

            msgBox.Show();
            msgBox.Focus();

            _currentWindow = msgBox;
            PopupManager.CloseActivePopup();
            return(msgBox);
        }
Пример #31
0
        private void _constructPlayerCurrentPrivateDeck(PlayerViewModel model)
        {
            if (model.CurrentPrivateDeck != null)
            {
                Trace.Assert(model.CurrentPrivateDeck.Cards != null);
                if (_privateDeckChoiceWindow != null)
                {
                    gridRoot.Children.Remove(_privateDeckChoiceWindow);
                }

                _privateDeckChoiceWindow = new ChildWindow();
                _privateDeckChoiceWindow.Template = Resources["DarkGreenWindowStyle"] as ControlTemplate;
                _privateDeckChoiceWindow.MaxWidth = 800;
                _privateDeckChoiceWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
                _privateDeckChoiceWindow.CloseButtonVisibility = Visibility.Collapsed;
                _privateDeckChoiceWindow.Effect = new DropShadowEffect() { BlurRadius = 10d };
                _privateDeckChoiceWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center;
                string title = PromptFormatter.Format(new CardChoicePrompt("PrivateDeck", model.Player, model.CurrentPrivateDeck.TraslatedName));
                _privateDeckChoiceWindow.Caption = title;

                var box = new PrivateDeckBox();
                box.DataContext = model.CurrentPrivateDeck.Cards;
                _privateDeckChoiceWindow.Content = box;

                gridRoot.Children.Add(_privateDeckChoiceWindow);
                _privateDeckChoiceWindow.Show();
            }
            else
            {
                gridRoot.Children.Remove(_privateDeckChoiceWindow);
                _privateDeckChoiceWindow = null;
            }
        }
Пример #32
0
        public void NotifyShowCardsStart(Player p, List<Card> cards)
        {
            Application.Current.Dispatcher.Invoke((ThreadStart)delegate()
            {
                if (_showHandCardsWindow != null)
                {
                    gridRoot.Children.Remove(_showHandCardsWindow);
                }

                _showHandCardsWindow = new ChildWindow();
                _showHandCardsWindow.Template = Resources["DarkGreenWindowStyle"] as ControlTemplate;
                _showHandCardsWindow.MaxWidth = 800;
                _showHandCardsWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
                _showHandCardsWindow.CloseButtonVisibility = Visibility.Visible;
                _showHandCardsWindow.Effect = new DropShadowEffect() { BlurRadius = 10d };
                _showHandCardsWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center;
                string title = PromptFormatter.Format(new CardChoicePrompt("ShowCards", p));
                _showHandCardsWindow.Caption = title;

                var viewModels = from c in cards select new CardViewModel() { Card = c };

                var box = new PrivateDeckBox();
                box.IsHitTestVisible = false;
                box.Margin = new Thickness(0, -20, 0, 0);
                box.DataContext = new ObservableCollection<CardViewModel>(viewModels);
                _showHandCardsWindow.Content = box;

                gridRoot.Children.Add(_showHandCardsWindow);
                _showHandCardsWindow.Show();

                _showHandCardsWindow.Closed += (o, e) =>
                {
                    GameModel.MainPlayerModel.AnswerEmptyMultichoiceQuestion();
                };
            });
        }
Пример #33
0
        void _player_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Application.Current.Dispatcher.Invoke((ThreadStart)delegate()
            {
                PlayerViewModel model = sender as PlayerViewModel;
                int count = GameModel.PlayerModels.Count;
                if (e.PropertyName == "IsCardChoiceQuestionShown")
                {
                    if (model.IsCardChoiceQuestionShown)
                    {
                        if (cardChoiceWindow != null)
                        {
                            gridRoot.Children.Remove(cardChoiceWindow);
                        }
                        cardChoiceWindow = new ChildWindow();
                        cardChoiceWindow.Template = Resources["DarkGreenWindowStyle"] as ControlTemplate;
                        cardChoiceWindow.MaxWidth = 800;
                        cardChoiceWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
                        cardChoiceWindow.CloseButtonVisibility = model.CardChoiceModel.CanClose ? Visibility.Visible : Visibility.Collapsed;
                        cardChoiceWindow.Effect = new DropShadowEffect(){ BlurRadius = 10d };
                        cardChoiceWindow.Caption = model.CardChoiceModel.Prompt;
                        var box = CardChoiceBoxSelector.CreateBox(model.CardChoiceModel);
                        if (box is CardArrangeBox)
                        {
                            (box as CardArrangeBox).OnCardMoved += (s1, s2, d1, d2) =>
                            {
                                var callback = model.CurrentCardChoiceRearrangeCallback;
                                if (callback != null)
                                {
                                    callback(new CardRearrangement(s1, s2, d1, d2));
                                }
                            };
                        }
                        gridRoot.Children.Add(cardChoiceWindow);
                        cardChoiceWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center;
                        cardChoiceWindow.Content = box;
                        cardChoiceWindow.Show();
                    }
                    else if (cardChoiceWindow != null)
                    {
                        cardChoiceWindow.Close();
                        gridRoot.Children.Remove(cardChoiceWindow);
                        cardChoiceWindow = null;
                    }
                }
                else if (e.PropertyName == "Role")
                {
                    int index;
                    for (index = 0; index < count; index++)
                    {
                        var playerModel = GameModel.PlayerModels[index];
                        if (playerModel == model) break;
                    }
                    Trace.Assert(index < count);

                    if (model.Player.Role == Role.Ruler)
                    {
                        gameLogs.Logs.Clear();
                        for (int i = 0; i < count; i++)
                        {
                            gameLogs.Logs.Add(GameModel.PlayerModels[(i + index) % count].Player, logDocs[i + 1]);
                        }
                    }
                }
                else if (e.PropertyName == "Hero")
                {
                    gameLogs.AppendPickHeroLog(model.Player, true);
                }
            });
        }
Пример #34
0
        private void _constructPlayerCurrentSpecialDeck(PlayerViewModel model)
        {
            if (model.CurrentSpecialDeck != null)
            {
                Trace.Assert(model.CurrentSpecialDeck.Cards != null);
                if (_privateDeckChoiceWindow != null)
                {
                    gridRoot.Children.Remove(_privateDeckChoiceWindow);
                }

                _privateDeckChoiceWindow = new ChildWindow();
                _privateDeckChoiceWindow.Template = Resources["BlackWindowStyle"] as ControlTemplate;
                _privateDeckChoiceWindow.MaxWidth = 800;
                _privateDeckChoiceWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
                _privateDeckChoiceWindow.CloseButtonVisibility = Visibility.Collapsed;
                _privateDeckChoiceWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center;
                string title = LogFormatter.Translate(new CardChoicePrompt("SpecialDeck", model.CurrentSpecialDeck.DeckPlace));
                _privateDeckChoiceWindow.Caption = title;

                var box = new PrivateDeckBox();
                box.DataContext = model.CurrentSpecialDeck.Cards;
                _privateDeckChoiceWindow.Content = box;

                gridRoot.Children.Add(_privateDeckChoiceWindow);
                _privateDeckChoiceWindow.Show();
            }
            else
            {
                gridRoot.Children.Remove(_privateDeckChoiceWindow);
                _privateDeckChoiceWindow = null;
            }
        }
Пример #35
0
 void desktopUserControl_OnProgramOpened(ChildWindow programUC)
 {
     programUC.Show();
     Root.Children.Add(programUC);
 }