コード例 #1
0
        private void DockLayoutManager_DockItemClosing(object sender, DevExpress.Xpf.Docking.Base.ItemCancelEventArgs e)
        {
            MessageBoxResult msgBoxResult = WinUIMessageBox.Show("Are you sure you want to remove " + e.Item.Caption + "?",
                                                                 "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (msgBoxResult == MessageBoxResult.Yes)
            {
                closedPanelName    = e.Item.Name.ToString();
                closedPanelCaption = e.Item.Caption.ToString();
                //MessageBox.Show(closedPanelName);
                UndoRemovedFlyout.HorizontalAlignment = HorizontalAlignment.Center;
                FlyoutLabelItem.Label             = e.Item.Caption + " is removed.  ";
                UndoRemovedFlyout.IsOpen          = true;
                UndoRemovedFlyout.Opacity         = 0.3;
                UndoRemovedFlyout.PlacementTarget = IntelliScreen as UIElement;
                dispatcherTimer =
                    new System.Windows.Threading.DispatcherTimer();
                dispatcherTimer.Tick    += dispatcherTimer_Tick;
                dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
                dispatcherTimer.Start();
            }
            else
            {
                e.Cancel = true;
                return;
            }
        }
コード例 #2
0
        private void DXWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            MessageBoxResult msgBoxResult = WinUIMessageBox.Show("Are you sure you want to exit?",
                                                                 "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (msgBoxResult == MessageBoxResult.Yes)
            {
                string query = "delete from Programs";
                ExecuteQuery(query);
                for (int i = 0; i < programs.Count; i++)
                {
                    string insertQuery = "INSERT INTO Programs (Id, Title, ProcessName, Brightness, Directory) VALUES('" + i +
                                         "', '" + programsTitleList[i] + "','" + programs[i] + "','" + brightnesses[i] +
                                         "','" + directoriesList[i] + "')";
                    ExecuteQuery(insertQuery);
                }
                TaskbarIcon.Dispose();
                Application.Current.Shutdown();
            }
            else
            {
                e.Cancel = true;
                return;
            }
        }
コード例 #3
0
        public async void Delete(int index, int?id)
        {
            if (id != null)
            {
                var window = Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive);
                var result = WinUIMessageBox.Show(window,
                                                  "Bạn có muốn xóa giá trị này?", "Xác nhận",
                                                  MessageBoxButton.YesNo, MessageBoxImage.None, MessageBoxResult.None, MessageBoxOptions.None, FloatingMode.Window);
                if (result == MessageBoxResult.Yes)
                {
                    bool del = await userRepo.Delete((int)id);

                    if (del)
                    {
                        users.RemoveAt(index);
                        message = MessageHelper.Get("del");
                    }
                    else
                    {
                        message = MessageHelper.Get("delErr");
                    }
                }
            }
            else
            {
                message = MessageHelper.Get("delNoti");
            }
        }
コード例 #4
0
        private void AddProgramFlyoutButton_Click(object sender, RoutedEventArgs e)
        {
            if (openFileDialog.FileName == "")
            {
                e.Handled = false;
                WinUIMessageBox.Show(null, "No program is selected!", "ERROR", MessageBoxButton.OK,
                                     MessageBoxImage.Error);
                return;
            }
            AddFlyout.IsOpen = false;

            /*try
             * {
             *  ProgramsComboBox.Items.Add(selectedProgram[0] + " - " + BrightnessTrackBar.Value);
             *  ProgramsComboBox.RefreshData();
             * }
             * catch (NullReferenceException )
             * {
             *  WinUIMessageBox.Show(null, "No program is selected!", "ERROR", MessageBoxButton.OK,
             *      MessageBoxImage.Error);
             * }*/

            //SetBrightness((byte)defaultBrightness);
            programs.Add(selectedProgram[0]);
            brightnesses.Add((byte)BrightnessTrackBar.Value);


            SelectProgram.Content = "Select Program";

            LayoutPanel  layoutPanel  = new LayoutPanel();
            TrackBarEdit trackBarEdit = new TrackBarEdit();

            layoutPanel.AllowRestore       = true; layoutPanel.Content = trackBarEdit;
            trackBarEdit.Value             = brightnesses[programsCount];
            trackBarEdit.EditValueChanged += new EditValueChangedEventHandler(trackBarEdit_EditValueChanged);
            directoriesList.Add(openFileDialog.FileName);
            Icon        icon        = System.Drawing.Icon.ExtractAssociatedIcon(openFileDialog.FileName);
            ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon(
                icon.Handle,
                Int32Rect.Empty,
                BitmapSizeOptions.FromEmptyOptions());


            layoutPanel.CaptionImage = imageSource;
            FileVersionInfo myFileVersionInfo =
                FileVersionInfo.GetVersionInfo(openFileDialog.FileName);

            programsTitleList.Add(myFileVersionInfo.FileDescription);

            layoutPanel.Caption = myFileVersionInfo.FileDescription;
            DockLayoutManager.DockController.Dock(layoutPanel, LayoutGroup1, DockType.Top);
            programsCount += 1;
            openFileDialog.Reset();
            SetBrightness((byte)defaultBrightness);
        }
コード例 #5
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     WinUIMessageBox.Show(
         Window.GetWindow(this),
         contentEdit.DisplayText,
         captionEdit.DisplayText,
         (MessageBoxButton)buttons.EditValue,
         (MessageBoxImage)icons.EditValue,
         MessageBoxResult.None, MessageBoxOptions.None,
         (FloatingMode)floatingMode.EditValue
         );
 }
コード例 #6
0
 private void ShowButton_Click(object sender, RoutedEventArgs e)
 {
     if (destination == "")
     {
         WinUIMessageBox.Show("No location is received yet.",
                              "Route", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         Browser.InvokeScript("GetRouteAddress", new string[] { origin, destination });
         //Label.Visibility = Visibility.Hidden;
     }
 }
コード例 #7
0
        public MainWindow()
        {
            InitializeComponent();
            HideScriptErrors(Browser, true);

            WinUIMessageBox.Show("Waiting for stations to connect... Connect a station first.",
                                 "Connection", MessageBoxButton.OK, MessageBoxImage.Information);

            listener = new TcpListener(4444);
            listener.Start();
            client = listener.AcceptTcpClient();
            ns     = client.GetStream();
        }
コード例 #8
0
        private async void CheckConnect()
        {
            BookRepository repo   = new BookRepository();
            bool           result = await repo.CheckConnect();

            if (!result)
            {
                var window = Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive);
                WinUIMessageBox.Show(window,
                                     "Không thể kết nối đến máy chủ!", "Lỗi",
                                     MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.None, MessageBoxOptions.None, FloatingMode.Window);
            }
        }
コード例 #9
0
        public async void DeleteExpense()
        {
            if (WinUIMessageBox.Show(
                    $"Are you sure you want to delete the expense {this.SelectedExpense.Name}?",
                    "delete expense",
                    MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                return;
            }

            this.Simulation.Items.Remove(this.SelectedExpense);
            await Task.Run(() => this.PersistenceService.DeleteBudgetItem(this.SelectedExpense));

            this.Loaded();
        }
コード例 #10
0
ファイル: MainWindow.xaml.cs プロジェクト: faizi-ch/Mini-Word
        private void BarButtonItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            MessageBoxResult msgBoxResult = WinUIMessageBox.Show("Are you sure you want to cancel without save?",
                                                                 "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (msgBoxResult == MessageBoxResult.Yes)
            {
                Environment.Exit(0);
            }
            else
            {
                if (!SaveButton.IsEnabled)
                {
                    SaveBarButtonItem_ItemClick(SaveButton, new ItemClickEventArgs(SaveButton, e.Link));
                }
            }
        }
コード例 #11
0
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult msgBoxResult =
                WinUIMessageBox.Show("Do you want to send the location?",
                                     "Location", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (msgBoxResult == MessageBoxResult.Yes)
            {
                try
                {
                    byte[] byteTime = Encoding.ASCII.GetBytes(loc + "===");
                    ns.Write(byteTime, 0, byteTime.Length);
                }
                catch (Exception exception)
                {
                    WinUIMessageBox.Show("Make sure you have made station application is running. Otherwise restart and then reconnect both.",
                                         "Sending ERROR", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
コード例 #12
0
        public async void NewSimulation()
        {
            if (WinUIMessageBox.Show(
                    "Creating a new simulation will erase all the assets, income and expenses. Do you want to continue?",
                    "new simulation",
                    MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                return;
            }

            this.IsBusy = true;

            try
            {
                await Task.Run(() => this.PersistenceService.DeleteSimulation(this.Simulation));

                this.Simulation = new Simulation();
                await Task.Run(() => this.PersistenceService.SaveSimulation(this.Simulation));
            }
            finally
            {
                this.IsBusy = false;
            }
        }
コード例 #13
0
        private void ItemCancelButton_Click(object sender, RoutedEventArgs e)
        {
            msgBoxResult = WinUIMessageBox.Show("Are you sure you want to cancel without save?",
                                                "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (msgBoxResult == MessageBoxResult.Yes)
            {
                //NewItemNavigationFrame.Navigate("ItemsView");
                //NewItemNavigationFrame.Navigate(new ItemsView());
                //DocumentOwner.close();
                //                 NavigationFrame frame = LayoutHelper.FindParentObject<NavigationFrame>((DependencyObject)sender);
                //                 JournalEntryStack f = ((IJournal)frame.Journal).BackStack as JournalEntryStack;
                //                 f.Clear();

                //                 var ownerFrame = LayoutHelper.FindLayoutOrVisualParentObject<NavigationFrame>(sender as DependencyObject, false);
                //                 ownerFrame.Journal.GoBack();
                //NewItemNavigationFrame.ClearCache();

                //                 var backStack = LayoutHelper.FindParentObject<INavigationFrame>(this).Journal.BackStack;
                //                 var backStackType = backStack.GetType();
                //                 var PopMethodInfo = backStackType.GetMethod("Pop", BindingFlags.Instance | BindingFlags.Public);
                //                 PopMethodInfo.Invoke(backStack, new Object[] {});
            }
        }
コード例 #14
0
 public static System.Windows.MessageBoxResult ShowCancelableConfirm(string header, string content)
 {
     return(WinUIMessageBox.Show(content, header, System.Windows.MessageBoxButton.YesNoCancel, System.Windows.MessageBoxImage.None));
 }
コード例 #15
0
 public static System.Windows.MessageBoxResult ShowConfirm(System.Windows.FrameworkElement owner, string header, string content)
 {
     return(WinUIMessageBox.Show(owner, content, header, System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.None));
 }
コード例 #16
0
 public static void ShowAlert(string header, string content)
 {
     WinUIMessageBox.Show(content, header, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.None);
 }
コード例 #17
0
 public static void ShowAlert(System.Windows.FrameworkElement owner, string header, string content)
 {
     WinUIMessageBox.Show(owner, content, header, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.None);
 }
コード例 #18
0
 private void ItemSaveButton_Click(object sender, RoutedEventArgs e)
 {
     WinUIMessageBox.Show("Are you sure you want to cancel without save?",
                          "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);
 }
コード例 #19
0
 public MessageBoxResult ShowMessage(string text, string caption, MessageBoxButton button, MessageBoxImage icon)
 {
     return(WinUIMessageBox.Show(text, caption, button, icon));
 }
コード例 #20
0
        private void CalculateButton_Click(object sender, RoutedEventArgs e)
        {
            StatusListEdit.Items.Clear();

            string destAddress;

            Double[] distances = new double[stations.Length];
            string[] durations = new string[stations.Length];
            int      c, location = 1;
            double   minimum;



            if (AddressTextEdit.Text == "")
            {
                WinUIMessageBox.Show("Please! Enter a destination address.",
                                     "Destination field is empty", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                StatusListEdit.Items.Add("Calculating distance...");

                destAddress = AddressTextEdit.Text;

                for (int i = 0; i < stations.Length; i++)
                {
                    DirectionsRequest directionsRequest2 = new DirectionsRequest()
                    {
                        Origin      = stations[i],
                        Destination = destAddress,
                    };

                    DirectionsResponse directionsResponse = GoogleMapsApi.GoogleMaps.Directions.Query(directionsRequest2);
                    GoogleMapsApi.Entities.Directions.Response.Leg leg =
                        directionsResponse.Routes.ElementAt(0).Legs.ElementAt(0);

                    StatusListEdit.Items.Add(string.Format("Distance from: {0} to {1} is {2} will take {3}", stations[i],
                                                           destAddress, leg.Distance.Text, leg.Duration.Text));

                    distances[i] = Convert.ToDouble(leg.Distance.Text.Substring(0, leg.Distance.Text.Length - 3));
                    durations[i] = leg.Duration.Text;
                }

                minimum = distances[0];
                for (c = 0; c < stations.Length; c++)
                {
                    if (distances[c] < minimum)
                    {
                        minimum  = distances[c];
                        location = c;
                    }
                }

                StatusListEdit.Items.Add(
                    string.Format("Station-{0} ({1}) has shortest distance from {2} of {3} km will take just {4}",
                                  location + 1, stations[location], destAddress, distances[location], durations[location]));

                Browser.Visibility = Visibility.Visible;
                Browser.InvokeScript("GetRouteAddress", new object[] { stations[location], destAddress });

                if (client != null)
                {
                    StatusListEdit.Items.Add("");



                    //byte[] bytes = new byte[1024];
                    //int bytesRead = ns.Read(bytes, 0, bytes.Length);
                    //string m = Encoding.ASCII.GetString(bytes, 0, bytesRead);
                    //Text = m;

                    loc = stations[location] + "/" + destAddress;
                    SendButton.Visibility = Visibility.Visible;
                }
            }

            //Browser.InvokeScript("calculateDistance", new string[] { station1, station2 });



            //Browser.InvokeScript("GetRouteLatLong", new object[] { station1, 33.6141098, 72.9947294 });
        }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     WinUIMessageBox.Show("WinUIMessageBox", "Test", MessageBoxButton.OKCancel, MessageBoxImage.Information);
 }