Doubt about using in Visual Studio

Asked

Viewed 187 times

1

I create a new project but can’t put those using as in this example below. He appears as in the other code below... Help me please =/

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Popups; // Não esqueça de adicionar este using

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?        LinkId=234238

namespace App1
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
    }

    private async void Button_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
    {
        // Aqui crio uma mensagem de dialog e a exibo.
        MessageDialog dialog = new MessageDialog("Teste", "Teste Dialog");
        await dialog.ShowAsync();
    }
}
}

He starts like this other:

using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication3
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        MessageBox.Show("Teste");
    }
}
}
  • Give more information. What happens when you try to write there to put what you want? In what situation you are. If you are unable to use the editor, you will have serious problems doing anything else more complicated.

  • Just to see if I understand your doubt using the first is different from the second? If that’s it you’ve already tried to add in the second the using you need?

  • I’m starting now at C# and would like to develop a Desktop system. I’m a little confused because the tutorials say it’s for windows 8, but it’s only for this S.O.? It would run on a Windows 7?

  • @Davidsouza my project is the second code, the first is a ready example I got. I would like to start a project like the one above, to make a Desktop system. I am using S.O. Windows 7

  • @Emersonmoraes in this case you can add the classes that are these "using" if for example you need to use the link use the line and so on "using System.Linq;" if that is not the question please describe so that we can help you.

  • @Davidsouza, here’s my question. I work in a company where they have a system here, the company system has the same design as Windows 8 even I working with the pc with windows 7. I would like to know how to develop this system because the look I have here does not come out equal, the design is all different...

Show 1 more comment

2 answers

2


The namespace Windows.UI.Xaml is present for the development of applications for Windows Store, so it was said that only works in Windows 8... there is no Windows Store for Windows 7.

If you want to program for Windows 7, you can use WPF which is what you seem to be doing... for your second snippet of code. However, the ready code you got won’t work.

More information: windows-ui-xaml-namespace-is-not-been-supported-in-visual-studio-2012-for-window

About appearance

WPF supports themes (i.e. skins). This is the way to make WPF programs look like anything else.

There you have two options:

  • Friend, but if I want to develop a desktop system with this model similar to windows 8, what do I need on my machine? I use Windows 7

  • I edited the answer... I’ll see if I find a theme for WPF similar to the Windows 8 Apps.

  • This system that I use here in my service for example, the dialog box is the one that occupies the full screen as in this link: http://answall.com/questions/57818/d%C3%Bavidas-em-desenvolvimento-de-sistemas-desktop-c/57847#57847 Because I am using S.O. Windows 7, they used this theme?

  • I suggest you raise another question "How to style a WPF application to look like Windows 8 applications (Metro style)"

  • Blz buddy, I’ll do that then.. Thank you!

  • In the link I passed in the part about finding a theme already ready, there are some examples of styles already ready, including open source on Github... take a look there, there are several cool themes.

  • Yes, I’ll do that... Thank you!

Show 2 more comments

1

Those using appear when you create a new Project/Solution at Visualstudio.

inserir a descrição da imagem aqui They are automatically placed by the IDE depending on the type of project you choose.

To develop a desktop application you must choose one of these:

  • Windows Forms Application
  • WPF Application
  • Console Application

The one that gets closer with Windows 8 is WPF Application.

  • If I choose one of these three, I still wouldn’t be able to use the: Message.Dialog ?? which is on using Windows.UI

  • Yes, you can. Both Windwsforms like the WPF have Messagebox.

  • But that’s the problem, my question is exactly that. I can put this Message.Dialog instead of Messagebox? I use a system here that appears and needed to do the same!

  • Not because this class is for Windows8 applications. To develop for Windows8 you need to be on a Windows8 computer.

  • But I would use which version of Visual Studio?

  • window8 - VS2012; Windows8.1 - VS2013.

  • i have Windows 8 at home, if I download this Windows8 VS2012 or 2013, I can create Desktop system to run on Windows 7?

  • Can as long as they are not Windows 8 Metro apps. Apps that have those using that you refer in question do not work in windows 7.

  • In the company that I work, I run a system there on Windows 7, and in the system has the design of a Windows 8, Equal of those using... is the theme or was created in Windows 8? Thanks for the patience

  • If runs in windows 7 is WPF with a theme of the kind indicated in Miguel’s reply.

  • Thank you Ramaral ^^

Show 6 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.