예제 #1
0
        /// <summary>
        /// Deletes the profile.
        /// </summary>
        public static void DeleteProfile(NetworkProfile profile = null)
        {
            if (profile == null)
            {
                profile = DataModel.SelectedNetworkProfile;

                if (profile == null)
                {
                    MyMessageBox.ShowMessage("No profile selected!");
                    return;
                }
            }

            // check if it is possibile to do operation
            if (UseCaseApplication.CheckIsOperationNotAllowedNow())
            {
                return;
            }

            bool res = MyMessageBox.Ask("Do you want to delete profile " + profile.Name + "?");

            if (res)
            {
                UseCaseLogger.ShowInfo("Remove profile [" + profile.Name + "]");
                DataModel.NetworkProfileList.Remove(profile);
                DataModel.SelectedNetworkProfile = null;
                UseCaseView.FindAndCloseProfile(profile);
                UseCaseProfile.Refresh();
            }
        }
예제 #2
0
 /// <summary>
 /// Runs the autodetect.
 /// </summary>
 /// <returns></returns>
 public static void RunAutoDetect(bool ask = true)
 {
     if (ask && MyMessageBox.Ask("Run profile automatic detect?"))
     {
         ViewModel.MainView.backgroundWorker.RunWorkerAsync(null);
     }
     else if (!ask)
     {
         ViewModel.MainView.backgroundWorker.RunWorkerAsync(null);
     }
 }
예제 #3
0
        /// <summary>
        /// Runs current profile.
        /// </summary>
        public static void Run()
        {
            // check if it is possibile to do operation
            if (UseCaseApplication.CheckIsOperationNotAllowedNow())
            {
                return;
            }

            if (DataModel.SelectedNetworkProfile == null)
            {
                MyMessageBox.ShowMessage("No profile selected!");
                return;
            }

            if (MyMessageBox.Ask("Do you want to run the profile " + DataModel.SelectedNetworkProfile.Name + "?"))
            {
                ViewModel.MainView.backgroundWorker.RunWorkerAsync(DataModel.SelectedNetworkProfile);
            }
        }
예제 #4
0
        /// <summary>
        /// Disables the network card.
        /// </summary>
        public static void DisableNetworkCard()
        {
            if (DataModel.SelectedNetworkCard == null)
            {
                MyMessageBox.ShowMessage("No network card selected!");
                return;
            }

            // check if it is possibile to do operation
            if (UseCaseApplication.CheckIsOperationNotAllowedNow())
            {
                return;
            }

            if (MyMessageBox.Ask("Do you want to disable network card " + DataModel.SelectedNetworkCard.Name + "?"))
            {
                SetStatusCard(false);
            }
        }