Example #1
0
        public override bool HandleChangedFile(string filename)
        {
            if (FileUtils.IsAffected(filename, IniFilename))
            {
                if (!Changed ||
                    ModernDialog.ShowMessage(ToolsStrings.AcObject_ReloadAutomatically_Ini, ToolsStrings.AcObject_ReloadAutomatically, MessageBoxButton.YesNo) ==
                    MessageBoxResult.Yes)
                {
                    ReloadIniData();
                }

                return(true);
            }

            return(false);
        }
Example #2
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (Selected == null)
            {
                return;
            }
            MessageBoxResult r = ModernDialog.ShowMessage(
                "Do you really want to remove account?",
                "Confirm delete", MessageBoxButton.YesNo, Window.GetWindow(this));

            if (r == MessageBoxResult.Yes)
            {
                AccountGroup.Accounts.Remove(Selected);
                Selected = null;
            }
        }
 private void SaveList(string filename)
 {
     try
     {
         XmlSerializer ser = new XmlSerializer(typeof(ObservableCollection <JobDownloadViewModel>));
         using (StreamWriter myWriter = new StreamWriter(filename))
         {
             ser.Serialize(myWriter, ViewData);
         }
     }
     catch (Exception ex)
     {
         MainWindow.Log.Error(ex.Message, ex);
         ModernDialog.ShowMessage(ex.Message, "Error Saving", MessageBoxButton.OK);
     }
 }
 private void btnAccounts_ManageAccounts_Delete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ModernDialog.ShowMessage("Do you really want to delete all the accounts from Database", "Confirm delete", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             QueryManager.deleteQuery();
             PDGlobals.loadedAccountsDictionary.Clear();
             AccounLoad();
         }
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
     }
 }
Example #5
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (backgroundWorkerLoad.IsBusy == false)
                {
                    progressBarMain.Visibility = System.Windows.Visibility.Visible;

                    backgroundWorkerLoad.RunWorkerAsync(new TagArguments(JobType.LoadComponents));
                }
            }
            catch (Exception ex)
            {
                ModernDialog.ShowMessage(ex.Message, "Error Loading", MessageBoxButton.OK);
            }
        }
Example #6
0
        private void bBersihkan_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxButton btn = MessageBoxButton.YesNo;
            var result           = ModernDialog.ShowMessage("ANDA AKAN MENGOSONGKAN SELURUH DATA ?\nSELURUH DATA AKAN DIHAPUS PERMANEN.\nLANJUTKAN ?", "INFORMASI !", btn);

            if (result.ToString() == "Yes")
            {
                var    logoutWindow = Window.GetWindow(this);
                TLogin mainWindow   = new TLogin();
                mainWindow.Show();
                if (logoutWindow != null)
                {
                    logoutWindow.Close();
                }
            }
        }
        private void PPbutton_Click(object sender, RoutedEventArgs e)
        {
            Auto con = new Auto();

            tv = con.GetTreeViewInfo();
            if (tv.Count == 7)
            {
                ModernDialog.ShowMessage("成功匹配到下单软件", "", MessageBoxButton.OK);
                Header.Text        = "匹配到下单软件";
                PPbutton.IsEnabled = false;
            }
            else
            {
                ModernDialog.ShowMessage("匹配下单软件失败", "", MessageBoxButton.OK);
            }
        }
 private void ContinueClick(object sender, RoutedEventArgs e)
 {
     if (_updateMatrixFlag)
     {
         MessageBoxResult answer = ModernDialog.ShowMessage("Would you like to update the matrix before proceeding ?", "Filters changed", MessageBoxButton.OKCancel);
         if (answer == MessageBoxResult.OK)
         {
             UpdateMatrix();
         }
         else if (answer == MessageBoxResult.Cancel)
         {
             return;
         }
     }
     NavigationCommands.GoToPage.Execute("/Pages/P4eventselection.xaml", null);
 }
Example #9
0
 // 查询电机转速
 public void qurMotoSpeed(SerialPort sp)
 {
     byte[] data = { motoAddress, 0x03, 0x08, 0x12, 0x00, 0x01, 0x26, 0x6F };
     dataCheck.crcCheck(data, 6);
     data[6] = dataCheck.LowByte;
     data[7] = dataCheck.HighByte;
     // 如果串口存在且已经打开
     if (SerialPort.GetPortNames().Contains <string>(sp.PortName) && sp.IsOpen)
     {
         sp.Write(data, 0, data.GetLength(0));
     }
     else
     {
         ModernDialog.ShowMessage("串口不存在或未打开,请选择正确串口并打开!#3", "Message:", MessageBoxButton.OK);
     }
 }
 void ConnectCamera()
 {
     try
     {
         camera = CameraAPI.GetInstance();
         camera.Connect();
         camera.NewFrameEvent      += new NewFrameHandler(camera_NewFrameEvent);
         camera.CapturedFrameEvent += new CapturedFrameHandler(camera_capturedFrameEvent);
         camera.setMode(CameraAPI.OperatingMode.POSTERIOR_MODE);
         CamMode = CameraAPI.OperatingMode.POSTERIOR_MODE.ToString();
     }
     catch (Exception ex)
     {
         ModernDialog.ShowMessage("Camera Not Responding. Please restart your process again.", "Alert", MessageBoxButton.OK);
     }
 }
 private void clkDeleteAccReport_PinScraper(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ModernDialog.ShowMessage("Are You Really Want To Delete This Data Permanently?", " Delete Account ", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             QM.DeleteAccountReport("PinScraper");
             GlobusLogHelper.log.Info(" => [ All Data is Deleted ] ");
         }
         AccountReport_PinScraper();
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Error(" Error :" + ex.StackTrace);
     }
 }
Example #12
0
        protected override void OnExecute(object parameter)
        {
            var table = parameter as TableElement;

            if (table == null)
            {
                ModernDialog.ShowMessage("no field detected.", "error", MessageBoxButton.OK);
                return;
            }
            var parent = table.Parent;

            View.Model.ClipboardItem = new TableElement(table);
            parent.Remove(table);
            table.Parent = null;
            View.RefreshDataTree(parent);
        }
Example #13
0
        private void ModernButton_Click_1(object sender, RoutedEventArgs e)
        {
            if (pwbPasswordBox1.Password != pwbPasswordBox2.Password)
            {
                ModernDialog.ShowMessage("Passwords do not match", "ERROR", MessageBoxButton.OK);
                return;
            }

            AuthenticationManager.CurrentUser.ChangePassword(pwbPasswordBox1.Password);

            Window window = new MainWindow();

            window.Show();

            this.Close();
        }
Example #14
0
        public void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!NetManager.Instance.IsConnected)
            {
                if (ModernDialog.ShowMessage("usmooth is [b]offline[/b], connect to a running game first.", "offline", MessageBoxButton.OK) == MessageBoxResult.OK)
                {
                    UsLogging.Printf("trying to enter the '[b]realtime[/b]' page when usmooth is [b]offline[/b], back to the main page.");

                    DefaultLinkNavigator dln = new DefaultLinkNavigator();
                    dln.Navigate(new Uri("/Pages/Home/Home.xaml", UriKind.Relative), this);
                    return;
                }
            }

            NetRequest_FrameData();
        }
Example #15
0
        public async Task RemoveEntryAsync(LapTimeEntry entry)
        {
            if (EnabledSources.Any(x => x.ReadOnly))
            {
                NonfatalError.Notify("Can’t remove entry from read-only sources",
                                     $"Please, disable {EnabledSources.Where(x => x.ReadOnly).Select(x => x.DisplayName).JoinToReadableString()}.", solutions: new[] {
                    new NonfatalErrorSolution("Disable read-only sources", null, token => {
                        foreach (var source in EnabledSources)
                        {
                            source.IsEnabled = false;
                        }

                        RaiseEntriesChanged();
                        return(Task.Delay(0));
                    }),
                });
                return;
            }

            var car   = CarsManager.Instance.GetById(entry.CarId)?.DisplayName ?? entry.CarId;
            var track = TracksManager.Instance.GetLayoutByKunosId(entry.TrackId)?.LayoutName ?? entry.TrackId;

            if (ModernDialog.ShowMessage($"Are you sure you want to remove {car} on {track} lap time?", "Remove Lap Time",
                                         MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            {
                return;
            }

            try {
                using (WaitingDialog.Create("Deleting…")) {
                    var changed = false;

                    foreach (var source in EnabledSources)
                    {
                        changed |= await source.RemoveAsync(entry.CarId, entry.TrackId);
                    }

                    if (changed)
                    {
                        Logging.Debug("Removed");
                        RaiseEntriesChanged();
                    }
                }
            } catch (Exception e) {
                NonfatalError.Notify("Can’t remove entry", e);
            }
        }
Example #16
0
        private void btnSavePrint_Click(object sender, RoutedEventArgs e)
        {
            int id = (int)PrintRequestListBox.SelectedValue;

            if (App.Server.GetPrintRequest(id).Status != PrintRequestStatus.Pending)
            {
                ModernDialog.ShowMessage("This material has been already printed.", "Message", MessageBoxButton.OK);
                return;
            }

            int copies;

            if (!int.TryParse(txtCopies.Text, out copies))
            {
                ModernDialog.ShowMessage("Copies should be an integer", "Error", MessageBoxButton.OK);
                return;
            }

            App.Server.UpdatePrintRequest(id, txtPrintContent.Text, copies, PrintRequestStatus.Printing);

            var request = (PrintRequestListItem)PrintRequestListBox.SelectedItem;

            request.Copies  = copies;
            request.Content = txtPrintContent.Text;

            var user = App.Server.GetUser(request.UserID);

            string docName = string.Format("{1}@{2}(len:{0})", request.Content.Length, user.Name + " " + request.UserNickName, request.Time.ToShortTimeString());

            PrintPlaintext(request.Content, docName, request.Copies);

            App.Server.UpdatePrintRequest(id, null, null, PrintRequestStatus.Done);

            var r = App.Server.GetPrintRequest(id);

            requestList[PrintRequestListBox.SelectedIndex] = new PrintRequestListItem
            {
                ID           = r.ID,
                Copies       = r.Copies,
                Content      = r.Content,
                Time         = r.Time,
                Status       = r.Status,
                UserNickName = r.UserNickName
            };
            PrintRequestListBox.Items.Refresh();
            ModernDialog.ShowMessage("Printing finished", "Message", MessageBoxButton.OK);
        }
Example #17
0
        private void General_Miller_Click(object sender, RoutedEventArgs e)
        {
            ///判断NX是否安装,如果有安装再判断详细版本
            ///判断注册表项是否存在
            RegistryKey NX = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Unigraphics Solutions\Installed Applications");

            if (NX == null)
            {
                ModernDialog.ShowMessage("您未安装NX软件", "警告", MessageBoxButton.OK);
            }
            else
            {
                MessageBoxResult result = ModernDialog.ShowMessage("确定要安装后处理文件吗?我们将会备份原始文件。", "提示", MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    string Post1 = AppDomain.CurrentDomain.BaseDirectory + @"CAP Post";
                    if (Directory.Exists(Post1))//判断是否存在
                    {
                        if (CheckNX10() == true)
                        {
                            Post("Unigraphics V28.0");
                        }
                        if (CheckNX11() == true)
                        {
                            Post("Unigraphics V29.0");
                        }
                        if (CheckNX12() == true)
                        {
                            Post("Unigraphics V30.0");
                        }
                        if (CheckNX1847() == true)
                        {
                            Post("Unigraphics V31.0");
                        }
                        if (CheckNX1872() == true)
                        {
                            Post("Unigraphics V32.0");
                        }
                        ModernDialog.ShowMessage("后处理文件安装完成,已将原始菜单文件后缀名改为.bak", "提示", MessageBoxButton.OK);
                    }
                    else
                    {
                        ModernDialog.ShowMessage("未找到后处理文件,请检查安装包是否完整。或者联系Capful", "警告", MessageBoxButton.OK);
                    }
                }
            }
        }
Example #18
0
        public static void ExchangeCurrency(string personFirstName, string personLastName, DateTime birthDate,
                                            string passportSeries, string passportId, string currencyName, double amount, bool isSelling)
        {
            var person = GetCustomerBO.GetCustomerByPassportId(passportId);

            if (person == null)
            {
                person = new Abstract.model.Person
                {
                    FirstName      = personFirstName, LastName = personLastName, BirthDate = birthDate,
                    PassportSeries = passportSeries, PassportId = passportId
                };
                CreateCustomerBO.CreateCustomer(person);
            }

            var currency = GetCurrencyBO.GetCurrencyByName(currencyName);

            var outcomeAmount = currency.Purchase * amount;

            if (isSelling)
            {
                outcomeAmount = amount / currency.Sell;
            }


            if (!ValidateForDailyLimits(amount, currency))
            {
                ModernDialog.ShowMessage("Person can't exchange more than 1000 units \nof currency per day.", "Warning",
                                         MessageBoxButton.OK);
                return;
            }

            var outReport = new Abstract.model.Report
            {
                UserId        = SessionService.GetInstance().User.UserId,
                PersonId      = person.PersonId,
                CurrencyId    = currency.CurrencyId,
                IncomAmount   = amount,
                OutcomeAmount = outcomeAmount,
                Date          = DateTime.Now
            };

            CreateReportBO.CreateReport(outReport);

            ModernDialog.ShowMessage("The operation completed successfully. \nYou need to issue " + outcomeAmount +
                                     " units of currency.", "Success!", MessageBoxButton.OK);
        }
Example #19
0
            public override async Task Drive(Game.BasicProperties basicProperties, Game.AssistsProperties assistsProperties,
                                             Game.ConditionProperties conditionProperties, Game.TrackProperties trackProperties)
            {
                var selectedCar   = CarsManager.Instance.GetById(basicProperties.CarId);
                var selectedTrack = TracksManager.Instance.GetLayoutById(basicProperties.TrackId, basicProperties.TrackConfigurationId);

                IEnumerable <Game.AiCar> botCars;

                try {
                    using (var waiting = new WaitingDialog()) {
                        if (selectedCar == null || !selectedCar.Enabled)
                        {
                            ModernDialog.ShowMessage(AppStrings.Drive_CannotStart_SelectNonDisabled, AppStrings.Drive_CannotStart_Title, MessageBoxButton.OK);
                            return;
                        }

                        if (selectedTrack == null)
                        {
                            ModernDialog.ShowMessage(AppStrings.Drive_CannotStart_SelectTrack, AppStrings.Drive_CannotStart_Title, MessageBoxButton.OK);
                            return;
                        }

                        botCars = await RaceGridViewModel.GenerateGameEntries(waiting.CancellationToken);

                        if (waiting.CancellationToken.IsCancellationRequested)
                        {
                            return;
                        }

                        if (botCars == null || !botCars.Any())
                        {
                            ModernDialog.ShowMessage(AppStrings.Drive_CannotStart_SetOpponent, AppStrings.Drive_CannotStart_Title, MessageBoxButton.OK);
                            return;
                        }
                    }
                } catch (TaskCanceledException) {
                    return;
                }

                await StartAsync(new Game.StartProperties {
                    BasicProperties     = basicProperties,
                    AssistsProperties   = assistsProperties,
                    ConditionProperties = conditionProperties,
                    TrackProperties     = trackProperties,
                    ModeProperties      = GetModeProperties(botCars)
                });
            }
Example #20
0
        private void buttonCopyLog_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(textBlockLog.Text) == false)
                {
                    Clipboard.SetText(textBlockLog.Text);

                    ModernDialog.ShowMessage("Log copied to clipboard", "Log Copied", MessageBoxButton.OK);

                    logger.Info("buttonCopyLog");
                }
            }
            catch (Exception)
            {
            }
        }
Example #21
0
        public override void Edit()
        {
            if (CurrentUserViewModel == null)
            {
                ModernDialog.ShowMessage("请选择一个用户。", "操作警告", MessageBoxButton.OK);
                return;
            }
            var addUserUserControl = new AddOrEditUserUserControl();
            var addOrEditViewModel = (addUserUserControl.DataContext as AddOrEditUserViewModel);

            addOrEditViewModel.UserViewModel  = CurrentUserViewModel;
            addOrEditViewModel.UserViewModels = UserViewModels;
            addOrEditViewModel.Action         = ViewModelAction.Edit;

            // 显示侧边框
            Activator.MainWindowService.ShowSidebar(addUserUserControl, 300, "编辑用户");
        }
 private void backgroundWorkerLoad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (this.Dispatcher.CheckAccess() == false)
     {
         this.Dispatcher.Invoke(new backgroundWorkerLoad_RunWorkerCompletedDelegate(backgroundWorkerLoad_RunWorkerCompleted), new object[] { sender, e });
     }
     else
     {
         try
         {
             if (e.Error != null)
             {
                 ModernDialog.ShowMessage(e.Error.Message, "Error setting Log", MessageBoxButton.OK);
             }
             else if (e.Cancelled)
             {
                 //    textBoxLog.AppendText("Cancelled!\r\n");
             }
             else
             {
                 if (e.Result != null)
                 {
                     if (e.Result is bool)
                     {
                         if ((bool)e.Result)
                         {
                             ModernDialog.ShowMessage("OK", "Creating Tag", MessageBoxButton.OK);
                         }
                         else
                         {
                             ModernDialog.ShowMessage("Was not Created.", "Creating Tag", MessageBoxButton.OK);
                         }
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             ModernDialog.ShowMessage(ex.Message, "Error", MessageBoxButton.OK);
         }
         finally
         {
             progressBarMain.Visibility = System.Windows.Visibility.Collapsed;
         }
     }
 }
 void EditorTabs_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Middle)
     {
         if (sender is TabItem)
         {
             IDEEditor editor = (sender as TabItem).Content as IDEEditor;
             TabItem   item   = sender as TabItem;
             if (editor != null)
             {
                 if (editor.IsDirty)
                 {
                     MessageBoxResult res = ModernDialog.ShowMessage("Save file changes before closing?", "Close?", MessageBoxButton.YesNoCancel);
                     if (res == MessageBoxResult.OK)
                     {
                         editor.Save();
                     }
                     else if (res == MessageBoxResult.Cancel)
                     {
                         return;
                     }
                 }
             }
             else
             {
                 if (item.Content is Control && ((Control)item.Content).Tag is PluginLib.IExternalControlData)
                 {
                     PluginLib.IExternalControlData data = ((Control)item.Content).Tag as PluginLib.IExternalControlData;
                     if (data.IsDirty)
                     {
                         MessageBoxResult res = ModernDialog.ShowMessage("Save file changes before closing?", "Close?", MessageBoxButton.YesNoCancel);
                         if (res == MessageBoxResult.Yes)
                         {
                             data.SaveData();
                         }
                         else if (res == MessageBoxResult.Cancel)
                         {
                             return;
                         }
                     }
                 }
             }
             tabs.Items.Remove(sender);
         }
     }
 }
Example #24
0
        // 速度模式停机
        public void stopMoto(SerialPort sp)
        {
            // 去掉速度使能
            dataCheck.crcCheck(disEnableSpd, 6);
            disEnableSpd[6] = dataCheck.LowByte;
            disEnableSpd[7] = dataCheck.HighByte;

            if (SerialPort.GetPortNames().Contains <string>(sp.PortName) && sp.IsOpen)
            {
                sp.Write(disEnableSpd, 0, disEnableSpd.GetLength(0));
                Thread.Sleep(100);
            }
            else
            {
                ModernDialog.ShowMessage("串口不存在或未打开,请选择正确串口并打开!#2.4", "Message:", MessageBoxButton.OK);
            }
        }
        private void btn_ScrapeUsername_keyword_SaveUser_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string Selected_item = string.Empty;
                if (IGGlobals.listAccounts.Count > 0)
                {
                    try
                    {
                        Selected_item = ScrapeUser_keyword_slect.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", "");

                        if (string.IsNullOrEmpty(Selected_item) && string.IsNullOrEmpty(txtMessage_UserName_keyword_NoOfUser.Text))
                        {
                            GlobusLogHelper.log.Info("Please Fill All Detail");
                            ModernDialog.ShowMessage("Please Fill All Detail", "Upload Message", MessageBoxButton.OK);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
                    }



                    ScrapingManager.User_key                  = Selected_item;
                    ScrapingManager.No_UserCount_keyword      = Convert.ToInt32(txtMessage_UserName_keyword_NoOfUser.Text);
                    ScrapingManager.UserScraper_UserByKeyword = true;
                }


                else
                {
                    GlobusLogHelper.log.Info("Please Load Accounts !");
                    GlobusLogHelper.log.Debug("Please Load Accounts !");
                }
                if ((!string.IsNullOrEmpty(Selected_item)) && (!string.IsNullOrEmpty(txtMessage_UserName_keyword_NoOfUser.Text)))
                {
                    ModernDialog.ShowMessage("Your Data Has Been Saved Successfully!!", "Success Message", MessageBoxButton.OK);
                }
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Error("Error : " + ex.StackTrace);
            }
        }
        /// <summary>
        /// Compares two or three process models
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <author>Thomas Meents, Christopher Licht</author>
        private void CompareClick(object sender, RoutedEventArgs e)
        {
            switch (ListOfChoosenProcessModels.Count)
            {
            case 2:
            {
                try
                {
                    IDifference diff = DiffFactory.CreateDifferenceObject <SnapshotDiff>();

                    Field diffField = new Field
                    {
                        ProcessModel = diff.CompareProcessModels(ListOfChoosenProcessModels)
                    };
                    if (diffField.ProcessModel != null && diffField.ProcessModel.GetType() == typeof(PetriNet))
                    {
                        String title = String.Join(", ", ListOfChoosenProcessModels.Select(pm => pm.Name));

                        ModernWindow pmDiffWindow = new ModernWindow
                        {
                            Style  = (Style)Application.Current.Resources["EmptyWindow"],
                            Width  = 1000,
                            Height = 600,
                            Owner  = Application.Current.MainWindow,
                            Title  = title
                        };
                        pmDiffWindow.Content = new PMViewer(diffField, pmDiffWindow, true, title);
                        pmDiffWindow.Show();
                    }
                }
                catch (Exception Ex)
                {
                    ErrorHandling.ReportErrorToUser("Error: " + Ex.Message);
                }
            }
            break;

            case 0:
                ModernDialog.ShowMessage("No process model checkboxes are checked", "Tip", MessageBoxButton.OK);
                break;

            default:
                ModernDialog.ShowMessage("Only two process models can be compared.\nCheck some checkboxes and click Compare to see the differences.", "Tip", MessageBoxButton.OK);
                break;
            }
        }
 //check link mv
 private void ModernButton_Click(object sender, RoutedEventArgs e)
 {
     if (txbLinkVideo.Text.StartsWith("http://mp3.zing.vn/video-clip") && txbLinkVideo.Text != "")
     {
         string id = GetLink.GetID(txbLinkVideo.Text);
         getLink.GetLinkMV(id);
         if (getLink.linkMV1080 != null && getLink.linkMV720 != null && getLink.linkMv480 != null)
         {
             RadioButton480.IsEnabled = RadioButton720.IsEnabled = RadioButton1080.IsEnabled =
                 buttonPath.IsEnabled = ButtonDownloadVideo.IsEnabled = ButtonViewOnWeb.IsEnabled = true;
         }
         else if (getLink.linkMV1080 == null && getLink.linkMV720 != null && getLink.linkMv480 != null)
         {
             RadioButton480.IsEnabled  = RadioButton720.IsEnabled =
                 buttonPath.IsEnabled  = ButtonDownloadVideo.IsEnabled = ButtonViewOnWeb.IsEnabled = true;
             RadioButton1080.IsEnabled = false;
         }
         else if (getLink.linkMV1080 == null && getLink.linkMV720 == null && getLink.linkMv480 != null)
         {
             RadioButton480.IsEnabled  =
                 buttonPath.IsEnabled  = ButtonDownloadVideo.IsEnabled = ButtonViewOnWeb.IsEnabled = true;
             RadioButton1080.IsEnabled = RadioButton720.IsEnabled = false;
         }
         else if (getLink.linkMV1080 == null && getLink.linkMV720 == null && getLink.linkMv480 == null && getLink.check == 1)
         {
             RadioButton480.IsEnabled = RadioButton720.IsEnabled = RadioButton1080.IsEnabled =
                 buttonPath.IsEnabled = ButtonDownloadVideo.IsEnabled = ButtonViewOnWeb.IsEnabled = false;
             ModernDialog.ShowMessage("Đã có lỗi xảy ra, hãy kiểm tra lại kết nối mạng !", "Lỗi", MessageBoxButton.OK);
         }
         else if (getLink.linkMV1080 == null && getLink.linkMV720 == null && getLink.linkMv480 == null &&
                  getLink.check == 2)
         {
             RadioButton480.IsEnabled          = RadioButton720.IsEnabled = RadioButton1080.IsEnabled =
                 ButtonDownloadVideo.IsEnabled = ButtonViewOnWeb.IsEnabled = false;
             txbPathVideo.Clear();
             ModernDialog.ShowMessage("Đã có lỗi xảy ra, hãy kiểm tra lại link bạn nhập !", "Lỗi", MessageBoxButton.OK);
         }
     }
     else
     {
         RadioButton480.IsEnabled          = RadioButton720.IsEnabled = RadioButton1080.IsEnabled =
             ButtonDownloadVideo.IsEnabled = ButtonViewOnWeb.IsEnabled = false;
         txbPathVideo.Clear();
         ModernDialog.ShowMessage("Link bạn nhập không đúng, hãy kiểm tra lại !", "Lỗi", MessageBoxButton.OK);
     }
 }
        //Check before navigating away to let the user confirm if they have any unsaved changes
        private bool CheckBeforeNavigating()
        {
            if (isChanged)
            {
                if (ModernDialog.ShowMessage("Your changes will not be saved.", "Warning", MessageBoxButton.OKCancel, true) == MessageBoxResult.Cancel)
                {
                    return(true);
                }
                else
                {
                    isChanged = false;
                    return(false);
                }
            }

            return(false);
        }
Example #29
0
        private async void LoadImageLinks()
        {
            FlickrImageLoader loader = (FlickrImageLoader)Tab.ContentLoader;

            try
            {
                // load image links and assign to tab list
                Tab.Links = await loader.GetInterestingnessListAsync();

                // select first link
                Tab.SelectedSource = Tab.Links.Select(l => l.Source).FirstOrDefault();
            }
            catch (Exception e)
            {
                ModernDialog.ShowMessage(e.Message, "Failure", MessageBoxButton.OK);
            }
        }
Example #30
0
        private void imgSourcePath_Drop(object sender, DragEventArgs e)
        {
            imgSourcePath.Source = new BitmapImage(new Uri("/CenaPlus.Client;component/Resources/Box.png", UriKind.Relative));
            var files = e.Data.GetData(DataFormats.FileDrop) as string[];

            if (files.Length != 1)
            {
                ModernDialog.ShowMessage("You must select a single file.", "Error", MessageBoxButton.OK);
                return;
            }
            else
            {
                txtCode.Document.Blocks.Clear();
                txtCode.Document.Blocks.Add(new Paragraph(new Run(System.IO.File.ReadAllText(files[0]))));
                lstLanguage.SelectedItem = Entity.DetectLanguage.PathToLanguage(files[0]).ToString();
            }
        }