private void DeleteItem(InventoryItem ii)
        {
            this.Items.Remove(ii);
            AppState.Current.State.Inventory.WeightCurrent -= ii.Weight * ii.Amount * ii.ItemWeightLogicMul;
            Stack <InventoryItem> itorem = new Stack <InventoryItem>();

            foreach (InventoryItem item in this.Items)
            {
                if (item.ContainerID.Equals(ii.ObjectID))
                {
                    itorem.Push(item);
                }
            }

            if (itorem.Count > 0)
            {
                MessageBoxResult mbr = MessageBox.Show(MainWindow.Translate("Message_ContainerWithItems_Desc"), MainWindow.Translate("Message_ContainerWithItems_Title"), MessageBoxButton.YesNo);
                if (mbr.HasFlag(MessageBoxResult.Yes))
                {
                    while (itorem.Count > 0)
                    {
                        InventoryItem item = itorem.Pop();
                        this.DeleteItem(item);
                    }
                }
                else
                {
                    InventoryItem item = itorem.Pop();
                    item.ContainerID = Guid.Empty;
                }
            }
        }
Example #2
0
        public bool Ask(string message)
        {
            MessageBoxResult result = MessageBox.Show(message, "Modern Application Framework", MessageBoxButton.YesNo,
                                                      MessageBoxImage.Question, MessageBoxResult.Yes, MessageBoxOptions.DefaultDesktopOnly);

            return(result.HasFlag(MessageBoxResult.Yes));
        }
Example #3
0
        private void CompraProprieta(object sender, RoutedEventArgs e)
        {
            Proprieta        T        = (Proprieta)Caselle[Giocatori[Turno].Posizione];
            MessageBoxResult Risposta = MessageBox.Show("Comprare '" + T.Nome + "' per L." + T.Costo + "?", "Conferma", MessageBoxButton.OKCancel);

            if (Risposta.HasFlag(MessageBoxResult.OK))
            {
                if (!Giocatori[Turno].Compra(T))
                {
                    MessageBox.Show("Non hai abbastanza soldi");
                }
            }

            Menu_Azioni.Visibility = Visibility.Collapsed;
            AggiornaInterfaccia();
        }
Example #4
0
        private void ConnectivityProblem()
        {
            _dataContext.Communication.Stop();
            _dataContext.Communication.Start();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                MessageBoxResult r = MessageBox.Show("Would you like to make sure that Bluetooth has been turned on?", "Unable to connect", MessageBoxButton.OKCancel);

                if (r.HasFlag(MessageBoxResult.OK))
                {
                    ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
                    connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.Bluetooth;
                    connectionSettingsTask.Show();
                }
            });
        }
        // Close buttom event
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            string           message = "Do you want to save the history";
            string           caption = "Save";
            MessageBoxButton buttons = MessageBoxButton.YesNo;
            // Show message box
            MessageBoxResult result = MessageBox.Show(message, caption, buttons);

            // if user click no
            if (result.HasFlag(MessageBoxResult.No))
            {
                cal.SaveFileOrNot('n');
            }
            else
            {
                cal.SaveFileOrNot('y');
            }
        }
Example #6
0
        private void ConfermaIpoteca(object sender, RoutedEventArgs e)
        {
            MessageBoxResult Risposta = MessageBox.Show("Sei sicuro di voler ipotecare queste proprietà per L." + GuadagnoTotale + "?", "Conferma", MessageBoxButton.OKCancel);

            if (Risposta.HasFlag(MessageBoxResult.OK))
            {
                foreach (object O in Stack_Proprieta.Children)
                {
                    CheckBox  C = (CheckBox)O;
                    Proprieta P = (Proprieta)Corrente.Proprieta[Stack_Proprieta.Children.IndexOf(C)];
                    if ((bool)C.IsChecked)
                    {
                        Corrente.Vendi(P);
                    }
                }
                this.Close();
            }
        }
Example #7
0
        public bool AskForConfirmation(string message)
        {
            MessageBoxResult result = MessageBox.Show(message, "Are you sure?", MessageBoxButton.OKCancel);

            return(result.HasFlag(MessageBoxResult.OK));
        }
Example #8
0
        public void UploadTheFile(string FileName, string FilePath)
        {
            try
            {
                string output, sendData;
                ClientSocket.SendMessage("UPLOAD");
                output = ClientSocket.ReceiveMessage();   //Normal size will be 256
                if (output.Equals("SEND"))
                {
                    //Sending FileName and checksum
                    sendData = string.Format("{0}${1}", FileName, md5Checksum(FilePath));
                    ClientSocket.SendMessage(sendData);

                    // Reply form server
                    output = ClientSocket.ReceiveMessage(256); // ALLOK , FILE_EXIST

                    //If file is already exist
                    if (output.Equals("FILE_EXIST"))
                    {
                        //File already present
                        MessageBoxResult result = MessageBox.Show("File is already exist, Do you wan't  to overwrite", "Error", MessageBoxButton.YesNo);
                        if (result.HasFlag(MessageBoxResult.No))
                        {
                            ClientSocket.SendMessage("NO");
                            return;
                        }
                        ClientSocket.SendMessage("YES");
                        ClientSocket.ReceiveMessage();      //Receive ALLOK
                    }
                    else if (output.Equals("ALLOK"))
                    {
                    }
                    else
                    {
                        MessageBoxResult result = MessageBox.Show("Same file is Exist at " + output, "Error", MessageBoxButton.YesNo);
                        if (result.HasFlag(MessageBoxResult.No))
                        {
                            ClientSocket.SendMessage("NO");
                            return;
                        }
                        ClientSocket.SendMessage("YES");
                        ClientSocket.ReceiveMessage();      //Receive ALLOK
                    }


                    // Sending FileSize
                    FileInfo fi = new FileInfo(FilePath);
                    ClientSocket.SendMessage(fi.Length.ToString());

                    output = ClientSocket.ReceiveMessage();
                    if (output.Equals("SENDFILE"))
                    {
                        //SendFile
                        ClientSocket.SendFile(FilePath);
                        output = ClientSocket.ReceiveMessage();

                        // Display in list
                        DisplayParentData();
                        OpenFolder(output);
                        MessageBox.Show("Successfully uploaded", "Output");
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Server have been stop");
                Environment.Exit(0);
            }
        }
Example #9
0
        public bool YesNoBox(string message, string caption)
        {
            MessageBoxResult result = MessageBox.Show(message, caption, MessageBoxButton.YesNo);

            return(result.HasFlag(MessageBoxResult.Yes));
        }