예제 #1
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public override void ShowAsSelected()
        ///
        /// \brief Shows as selected
        ///-------------------------------------------------------------------------------------------------

        public override void ShowAsSelected()
        {
            base.ShowAsSelected();
            if (adjustButton == null)
            {
                adjustButton = new AdjustButton(MainWin.GetInstance().MainView(), this,
                                                Common.RotatingPoint(new Point(rect.Right, rect.Top), midPoint, angle),
                                                Cursors.SizeNS);
                adjustButton.MouseDown += AdjustButton_MouseDown;
                adjustButton.MouseUp   += AdjustButton_MouseUp;
                adjustButton.MouseMove += AdjustButton_MouseMove;
            }
            if (moveButton == null)
            {
                moveButton = new MoveButton(MainWin.GetInstance().MainView(),
                                            this,
                                            Common.RotatingPoint(new Point(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2), midPoint, angle),
                                            Cursors.SizeAll);
                moveButton.MouseDown += MoveButton_MouseDown;
                moveButton.MouseMove += MoveButton_MouseMove;
                moveButton.MouseUp   += MoveButton_MouseUp;
                moveButton.SetBindingPoints(
                    new Ref <Point>(() => rect.Location, z => { rect.Location = Common.RotatingPoint(z, midPoint, -angle); }),
                    new Ref <Point>(() => adjustButton.Location, z => { adjustButton.Location = z; })
                    );
            }
            Log.LogText(string.Format("Select Ellipse ({0},{1}),({2},{3})", rect.Left, rect.Top, rect.Right, rect.Bottom));
        }
예제 #2
0
 public WangYi(string Url, string file, MainWin mw)
 {
     this.NewsUrl = Url;
     this.file    = file;
     this.mw      = mw;
     Init();
 }
예제 #3
0
 public MainWinViewModel(LoginMessage msg, MainWin win)
 {
     this.Win        = win;
     this.User       = msg;
     Win.DataContext = msg;
     OnInit();
 }
예제 #4
0
        /// <summary>
        /// Handles click on OK button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void buttonOk_Click(object sender, RoutedEventArgs e)
        {
            bool issueReporterUpdated = this.connectionCtrl.UpdateConfigFromSelections(Configuration);

            this.appSettingsCtrl.UpdateConfigFromSelections(Configuration);

            IReadOnlyDictionary <string, object> diff = ConfigurationModel.Diff(this.configSnapshot, Configuration);

            if (diff.Count > 0)
            {
                MainWin.HandleConfigurationChanged(diff);
            }

            if (issueReporterUpdated)
            {
                MainWin.UpdateMainWindowConnectionFields();
            }

            if (await HandleReleaseSwitch().ConfigureAwait(false))
            {
                return;
            }

            Dispatcher.Invoke(() => MainWin.TransitionToSelectActionMode());
        }
예제 #5
0
        private async Task <bool> HandleReleaseSwitch()
        {
            var channelDialog = new ChangeChannelContainedDialog(appSettingsCtrl.SelectedReleaseChannel);

            if (appSettingsCtrl.SelectedReleaseChannel == Configuration.ReleaseChannel ||
                !await MainWin.ctrlDialogContainer.ShowDialog(channelDialog).ConfigureAwait(false))
            {
                return(false);
            }

            try
            {
                VersionSwitcherWrapper.ChangeChannel(appSettingsCtrl.SelectedReleaseChannel);
                Dispatcher.Invoke(() => MainWin.Close());
                return(true);
            }
            catch (Exception ex)
            {
                ex.ReportException();

                Dispatcher.Invoke(() =>
                                  MessageDialog.Show(string.Format(CultureInfo.InvariantCulture, Properties.Resources.ConfigurationModeControl_VersionSwitcherException))
                                  );
            }

            return(false);
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            MainWin MainWin = new MainWin();

            MainWin.Show(this);
        }
예제 #7
0
        private void DialSuccess()
        {
            this.stat = 1;
            if (main_win == null)
            {
                main_win = new MainWin();
            }
            Width           = 900;
            Height          = 700;
            main_win.Height = 700;
            main_win.Width  = 900;
            string ip = new GetIPAddress(Utils.adapterName).GetIPv4AddressByAdapterName();

            main_win.setNetIP(ip == "" ? "0.0.0.0" : ip);
            main_win.setUserName(login_panel.username);
            double screenWidth  = System.Windows.SystemParameters.PrimaryScreenWidth;
            double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
            double windowWidth  = this.Width;
            double windowHeight = this.Height;

            this.Left = (screenWidth / 2) - (windowWidth / 2);
            this.Top  = (screenHeight / 2) - (windowHeight / 2);
            canvas.Children.Add(main_win);
            canvas.Children.Remove(login_panel);
            canvas.RegisterName("main_win", main_win);

            Thread dial_thread = new Thread(dial.getStatus);

            dial_thread.Start();
        }
예제 #8
0
 public PopupUserInfoMng(MainWin _mainWin)
 {
     mainWin = _mainWin;
     InitializeComponent();
     ThemeApply.Themeapply(this);
     Loaded          += PopupUserInfoMng_Loaded;
     ContentRendered += PopupUserInfoMng_ContentRendered;
 }
예제 #9
0
 /// <summary>
 /// Hide control and hilighter
 /// </summary>
 public void HideControl()
 {
     HollowHighlightDriver.GetDefaultInstance().HighlighterMode = prevMode;
     MainWin.SetHighlightBtnState(prevHighlighterState);
     HollowHighlightDriver.GetDefaultInstance().IsEnabled = prevHighlighterState;
     UpdateConfigWithSize();
     this.Visibility = Visibility.Collapsed;
 }
 /// <summary>
 /// Event handler for Got it button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnExit_Click(object sender, RoutedEventArgs e)
 {
     if (ckbxDontShow.IsChecked.Value)
     {
         ConfigurationManager.GetDefaultInstance().AppConfig.ShowWelcomeScreenOnLaunch = false;
     }
     MainWin.HandleBackToSelectingState();
 }
예제 #11
0
        static void Main()
        {
            //WpfTest app = new WpfTest();
            //app.Start();
            //int i = app.GetInt();

            MainWin app2 = new MainWin();

            app2.Start();
        }
예제 #12
0
 /// <summary>
 /// Request Test with selected element
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnTest_Click(object sender, RoutedEventArgs e)
 {
     if (this.SelectedInHierarchyElement != null)
     {
         var sa = SelectAction.GetDefaultInstance();
         sa.SetCandidateElement(this.SelectedInHierarchyElement.Item1, this.SelectedInHierarchyElement.Item2);
         sa.Select();
         MainWin.HandleSnapshotRequest(MainWindow.TestRequestSources.HierarchyNode);
     }
 }
예제 #13
0
 private void PrintButton_Click(object sender, RoutedEventArgs e)
 {
     PeekABoo();
     MainWin.InvalidateArrange();
     MainWin.InvalidateMeasure();
     MainWin.InvalidateVisual();
     Canvas.InvalidateArrange();
     Canvas.InvalidateMeasure();
     Canvas.InvalidateVisual();
     MainWin.Width = MainWin.ActualWidth - 1;
 }
        /// <summary>
        /// Handles click on OK button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonOk_Click(object sender, RoutedEventArgs e)
        {
            this.connectionCtrl.UpdateConfigFromSelections(Configuration);
            this.appSettingsCtrl.UpdateConfigFromSelections(Configuration);

            IReadOnlyDictionary <string, object> diff = ConfigurationModel.Diff(this.configSnapshot, Configuration);

            if (diff.Count > 0)
            {
                MainWin.HandleConfigurationChanged(diff);
            }
        }
예제 #15
0
        private void ListItem(EventTest3 et3, string title)
        {
            int offset = 4;

            MainWin.AppendMessageTbk2(nl);

            DebugPrint(CheckedStateSymbol(et3.SelectState) + " " +
                       et3.NodeType.ToString().PadRight(7) + "| " + title, "chk count| " + et3.CheckedCount +
                       (et3.NodeType == NodeType.BRANCH ? " :: children| " + et3.childList?.Count ?? "none" : "")
                       , 0, offset);
            DebugPrint("", et3.SelectState + " :: orig| "
                       + et3.SelectStateOriginal, offset, 0);
        }
예제 #16
0
        private async void btn_join_Click(object sender, RoutedEventArgs e)
        {
            MainWin w = new MainWin();

            await GetAccounts();

            if (login == true)
            {
                w.Username = txt_username.Text;
                w.Password = txt_password.Password;
                w.Show();
                this.Close();
            }
        }
예제 #17
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Ttologin login = new Ttologin();

            login.ShowDialog();
            if (login.DialogResult == DialogResult.OK)
            {
                MainWin main = new MainWin();

                Application.Run(main);
            }
        }
예제 #18
0
        /// <summary>
        /// Load event records
        /// </summary>
        /// <param name="el"></param>
        internal void LoadEventRecords(List <EventMessage> el)
        {
            this.ctrlTabs.CurrentMode = InspectTabMode.LoadedEvents;

            this.ctrlEvents.LoadEventRecords(el);
            HollowHighlightDriver highlightDriver = HollowHighlightDriver.GetDefaultInstance();

            if (highlightDriver.IsEnabled)
            {
                highlightDriver.IsEnabled       = false;
                highlightDriver.HighlighterMode = HighlighterMode.Highlighter;
                MainWin.SetHighlightBtnState(false);
            }
        }
        private async Task <bool> HandleReleaseSwitch()
        {
            if (appSettingsCtrl.SelectedReleaseChannel == Configuration.ReleaseChannel)
            {
                return(false);
            }

            Logger.PublishTelemetryEvent(TelemetryEventFactory.ForReleaseChannelChangeConsidered(
                                             Configuration.ReleaseChannel, appSettingsCtrl.SelectedReleaseChannel));

            var channelDialog = new ChangeChannelContainedDialog(appSettingsCtrl.SelectedReleaseChannel);

            if (!await MainWin.ctrlDialogContainer.ShowDialog(channelDialog).ConfigureAwait(false))
            {
                return(false);
            }

            // If the window is topmost, the UAC prompt from the version switcher will appear behind the main window.
            // To prevent this, save the previous topmost state, ensure that the main window is not topmost when the
            // UAC prompt will display, then restore the previous topmost state.
            bool previousTopmostSetting = Configuration.AlwaysOnTop;

            try
            {
                Dispatcher.Invoke(() =>
                {
                    previousTopmostSetting = MainWin.Topmost;
                    MainWin.Topmost        = false;
                });
                VersionSwitcherWrapper.ChangeChannel(appSettingsCtrl.SelectedReleaseChannel);
                Dispatcher.Invoke(() => MainWin.Close());
                return(true);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
            {
                ex.ReportException();

                Dispatcher.Invoke(() =>
                {
                    MainWin.Topmost = previousTopmostSetting;
                    MessageDialog.Show(Properties.Resources.ConfigurationModeControl_VersionSwitcherException);
                });

                return(false);
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }
        /// <summary>
        /// Refresh
        /// </summary>
        public void Refresh()
        {
            // data will be asked to be captured again. so set the CurrentView right.
            MainWin.SetCurrentViewAndUpdateUI(TestView.CapturingData);

            ImageOverlayDriver.ClearDefaultInstance();

            var ecId = SelectAction.GetDefaultInstance().GetSelectedElementContextId().Value;

            SetDataAction.ReleaseDataContext(ecId);
#pragma warning disable CS4014
            // NOTE: We aren't awaiting this async call, so if you
            // touch it, consider if you need to add the await
            this.SetElement(ecId);
#pragma warning restore CS4014
        }
 /// <summary>
 /// understand the selection change and update view info.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // make sure that tab change is really reflected only when Test Mode is Visible.
     if (this.Visibility == Visibility.Visible && MainWin != null && MainWin.CurrentView is TestView)
     {
         // make sure that mode is update only when it is relevant
         if (this.tbiAutomatedChecks.IsSelected && (TestView)MainWin.CurrentView == TestView.TabStop)
         {
             MainWin.SetCurrentViewAndUpdateUI(TestView.AutomatedTestResults);
         }
         else if (this.tbiTabStop.IsSelected && (TestView)MainWin.CurrentView == TestView.AutomatedTestResults)
         {
             MainWin.SetCurrentViewAndUpdateUI(TestView.TabStop);
         }
     }
 }
예제 #22
0
        internal static void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg)
        {
            MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                if (OnMessage != null)
                {
                    OnMessage(sender, msg);
                }

                if (msg.Subject != null)
                {
                    ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);

                    if (subject == ChatSubjects.PRACTICE_GAME_INVITE ||
                        subject == ChatSubjects.GAME_INVITE)
                    {
                        MainWin.FlashWindow();
                        NotificationPopup pop   = new NotificationPopup(subject, msg);
                        pop.Height              = 230;
                        pop.HorizontalAlignment = HorizontalAlignment.Right;
                        pop.VerticalAlignment   = VerticalAlignment.Bottom;
                        NotificationGrid.Children.Add(pop);
                    }
                    else if (subject == ChatSubjects.GAME_MSG_OUT_OF_SYNC)
                    {
                        MessageOverlay messageOver         = new MessageOverlay();
                        messageOver.MessageTitle.Content   = "Game no longer exists";
                        messageOver.MessageTextBox.Text    = "The game you are looking for no longer exists.";
                        Client.OverlayContainer.Content    = messageOver.Content;
                        Client.OverlayContainer.Visibility = Visibility.Visible;
                    }
                }
            }));

            //On core thread
            if (msg.Subject != null)
            {
                return;
            }

            if (AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body))
            {
                ChatPlayerItem chatItem = AllPlayers[msg.From.User];
                chatItem.Messages.Add(chatItem.Username + "|" + msg.Body);
                MainWin.FlashWindow();
            }
        }
예제 #23
0
        public MakeOutQuestions()
        {
            InitializeComponent();

            //DocumentForm documentForm = new DocumentForm(string.Empty);
            //documentForm.Dock = DockStyle.Fill;
            ////documentForm.FormBorderStyle = FormBorderStyle.None;
            //documentForm.TopLevel = false;
            //this.Controls.Add(documentForm);
            //documentForm.Show();

            MainWin mainWin = new MainWin();

            mainWin.ShowDialog();
            OpenDocumentWhileMainWinClosed(mainWin.filePathList);
            this.PerformLayout();
        }
예제 #24
0
        public static void Main(string[] args)
        {
            Application.Init();

            Boolean isDatabaseOpened = DataBase.Open(cnfg.getConfiguration("server"),
                                                     cnfg.getConfiguration("database"),
                                                     cnfg.getConfiguration("usr"),
                                                     cnfg.getConfiguration("pwd"));

            if (!isDatabaseOpened)
            {
                dlg.show(null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un error al intentar abrir la base de datos Servidor: {0}, Base de datos: {1}", cnfg.getConfiguration("server"), cnfg.getConfiguration("database")));
            }
            else
            {
                Languaje = cnfg.DefaultLanguaje;

                loadPanels();

                string messageResponse;
                if (MainWin.AutoConnectPorts(out messageResponse))
                {
                    MainWin.Visible = true;

                    /*
                     * TODO: INICIO DE CODIGO DE SIMULACIÓN - [BOORAR AL IMPLEMENTAR]
                     */
                    MainWin.configureTimerPaySimulation();

                    /*
                     * FIN DE CODIGO DE SIMULACIÓN
                     */

                    Application.Run();
                }
                else
                {
                    dlg.show(null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, string.Format("Ocurrió un problema al intentar conectar al/los puerto(s) [ {0} ]", messageResponse));
                    unloadPanels();
                }

                DataBase.Close();
            }
        }
예제 #25
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public override void ShowAsSelected()
        ///
        /// \brief Shows as selected
        ///-------------------------------------------------------------------------------------------------

        public override void ShowAsSelected()
        {
            base.ShowAsSelected();
            if (adjustButtonA == null)
            {
                adjustButtonA            = new AdjustButton(MainWin.GetInstance().MainView(), this, new Point(a.X - 3, a.Y - 3), Cursors.SizeNS);
                adjustButtonA.MouseDown += ResizeButtonA_MouseDown;
                adjustButtonA.MouseUp   += ResizeButtonA_MouseUp;
                adjustButtonA.MouseMove += ResizeButtonA_MouseMove;
            }
            if (adjustButtonB == null)
            {
                adjustButtonB            = new AdjustButton(MainWin.GetInstance().MainView(), this, new Point(b.X - 3, b.Y - 3), Cursors.SizeNS);
                adjustButtonB.MouseDown += ResizeButtonA_MouseDown;
                adjustButtonB.MouseUp   += ResizeButtonA_MouseUp;
                adjustButtonB.MouseMove += ResizeButtonA_MouseMove;
            }
            if (moveButton == null)
            {
                moveButton = new MoveButton(MainWin.GetInstance().MainView(),
                                            this, new Point(a.X / 2 + b.X / 2, a.Y / 2 + b.Y / 2),
                                            Cursors.SizeAll);
                moveButton.MouseDown += MoveButton_MouseDown;
                moveButton.MouseMove += MoveButton_MouseMove;
                moveButton.MouseUp   += MoveButton_MouseUp;
            }

            adjustButtonA.SetBindingPoints(
                new Ref <Point>(() => a, z => { a = z; })
                );
            adjustButtonB.SetBindingPoints(
                new Ref <Point>(() => b, z => { b = z; })
                );
            moveButton.SetBindingPoints(
                new Ref <Point>(() => a, z => { a = z; }),
                new Ref <Point>(() => b, z => { b = z; }),
                // only lines'point moving is not enough. We need move its buttons.
                new Ref <Point>(() => adjustButtonA.Location, z => { adjustButtonA.Location = z; }),
                new Ref <Point>(() => adjustButtonB.Location, z => { adjustButtonB.Location = z; })
                );

            Log.LogText("Select Line");
        }
 /// <summary>
 /// Handle Stop Recording notification from event recording control
 /// </summary>
 private void HandleRecordingChange(bool isStarted)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         if (MainWin.CurrentPage == AppPage.Events)
         {
             if (isStarted)
             {
                 MainWin.SetCurrentViewAndUpdateUI(EventsView.Recording);
                 this.ctrlTabs.Clear();
             }
             else
             {
                 MainWin.SetCurrentViewAndUpdateUI(EventsView.Stopped);
             }
             this.ctrlTabs.IsRecordingChanged(isStarted);
         }
     });
 }
예제 #27
0
        /// <summary>
        /// Show control and hilighter
        /// </summary>
        public void ShowControl()
        {
            this.Visibility           = Visibility.Visible;
            this.prevHighlighterState = HollowHighlightDriver.GetDefaultInstance().IsEnabled;
            this.prevMode             = HollowHighlightDriver.GetDefaultInstance().HighlighterMode;
            HollowHighlightDriver.GetDefaultInstance().HighlighterMode = HighlighterMode.Highlighter;
            MainWin.SetHighlightBtnState(true);
            HollowHighlightDriver.GetDefaultInstance().IsEnabled = true;
            HollowHighlightDriver.GetDefaultInstance().Clear();

            SelectAction.GetDefaultInstance().ClearSelectedContext();

            Dispatcher.InvokeAsync(() =>
            {
                this.SetFocusOnDefaultControl();
            }
                                   , System.Windows.Threading.DispatcherPriority.Input);

            ctrlContrast.SetAutoCCAState(true);
        }
예제 #28
0
    internal static Button Button(MainWin w, ToolBar parent, string name, ICommand cmd,
                                  bool requiressel = false, Action act = null)
    {
        var tt = new ToolTip();

        tt.Content = name;
        var bt = new Button {
            Content = name, ToolTip = tt
        };
        var bm = LoadImage(name);

        if (bm != null)
        {
            var im = new Image();
            im.Source  = bm;
            im.Height  = im.Width = 16;
            bt.Content = im;
        }
        bt.Command = cmd;
        if (act != null)
        {
            w.CommandBindings.Add(new CommandBinding(cmd, (s, e) => act(),
                                                     (s, e) => e.CanExecute = !requiressel ||
                                                                              w.sel.selected != null));
        }
        //bt.Click += (s, e) => act();
        if (!bt.IsEnabled)
        {
            bt.Opacity = 0.5f;
        }
        bt.IsEnabledChanged += (s, e) => bt.Opacity = (bool)e.NewValue ? 1.0f : 0.5f;
        if (parent != null)
        {
            parent.Items.Add(bt);
        }
        return(bt);

        //KeyBinding OpenCmdKeyBinding =
        //               new KeyBinding(ApplicationCommands.Copy, Key.C, ModifierKeys.Control);
        //this.InputBindings.Add(OpenCmdKeyBinding);
    }
예제 #29
0
        internal static void ChatClient_OnMessage(object sender, jabber.protocol.client.Message msg)
        {
            if (msg.Subject != null)
            {
                MainWin.Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
                {
                    ChatSubjects subject = (ChatSubjects)Enum.Parse(typeof(ChatSubjects), msg.Subject, true);
                    //NotificationPopup pop = new NotificationPopup(subject, msg);
                    //pop.Height = 230;
                    //pop.HorizontalAlignment = HorizontalAlignment.Right;
                    //pop.VerticalAlignment = VerticalAlignment.Bottom;
                    //Client.NotificationGrid.Children.Add(pop);
                }));

                return;
            }

            if (AllPlayers.ContainsKey(msg.From.User) && !String.IsNullOrWhiteSpace(msg.Body))
            {
                ChatPlayerItem chatItem = AllPlayers[msg.From.User];
                chatItem.Messages.Add(chatItem.Username + "|" + msg.Body);
                MainWin.FlashWindow();
            }
        }
 public SelectSize(MainWin f1)
 {
     this.f1 = f1;
     InitializeComponent();
 }