⬆️ ⬇️

TagToDo, Yes, another ToDo-shka

Dream



I always had a dream to write "unforgettable". Many times I started this task, but either the desire disappeared at the stage of the layout, or my friends said: “why is there another ToDo-shk, so there are a million of them”. But the desire to write something of their own did not disappear. And here at work there were relatively calm days, and I again set myself a dark goal: to write my “unforgettable” in the end. And since I worked only with desktop applications up to the village, and on the Web it wasn’t a tooth on my foot, I decided to combine the study with a long-held dream. Considering that my main bread is .Net + WPF. I chose the Silverlight platform. It seems like .Net + WPF, but something new. Quickly set a goal, and ideally I should have completed in 5 days.



We have a goal.



The purpose of the project, the main idea: Quickly add a task and hang (quickly) tags on it, so that you can filter by tags! Everything. When another brilliant idea appears, poke its nose at the main idea. And postpone. All the ideas as they should be, spinning in the head, constantly multiplying. But I managed to resist them. This helped me plan.



The plan is as follows.



1. Navigate the prototype interface for 1 day.

2. Make a database and close it behind the business layer. (1 day)

3. In general, nakodit and get the first beta. (1 day)

4. Shooting bugs (2 days)

The plan is not God knows what, but I followed it. The prototype was drawn in the Kaxaml program (I still draw prototypes in the form of xaml code, and not on pieces of paper or special programs), and there I made my first mistake, I painted the prototype for WPF, and it differs from Silverlight quite a lot. Later, I shipped quite a few trifles, although they did not affect the appearance.



Clothes



The final view has not changed:

image

I'm not a designer, so I decided to just “lick” the interface from various iPhone mockups. Although, I am not a fan of this phone, but I really like the interface. I will not describe this stage in detail, only the main problems. First and foremost: Silverlight Xaml is not a subset of WPF-xaml, they are very different in details. This has already been referenced by dotCypress . I did all the tricky animations through the VisualStateManager , its main idea is visible, by the way, from the title: the organization of state control, and the control of state transitions. Quite convenient, but not familiar to those who played with triggers in WPF.

-

And where is our business logic?



Since I already have a small hosting under Windows and a MS SQL 2008 database, for obvious reasons, I wrote a database there. Although, which I justify myself, I have worked all my life only with microsoftware databases, and I don’t regret it a bit. All the tudushka got into one tablet and 2 stored procedures, one of which added a tudushka, if it was not there, updated it if it was, and deleted if its main text was empty (I had to do 3 pieces, but then I skalavil, 3% DB business logic is not killed). The second store just got a task list. As the task ID, I took the date of its creation. Mindful of the article , the business layer was completely transferred to the service (silverlight enabled service), to which the program should apply, all 97%. Initially I wanted to pull all the stored procedures with “handles,” but decided to remind myself of the wonderful Rsdn.Framework.Data . Therefore, everything was written through it. The class of the task itself after attaching the attributes from Rsdn and WCF to it looked like this:

[DataContract]

public class ToDo {

[MapField("id")]

[DataMember]

public DateTime Id { get; set; }



[MapField("text")]

[DataMember]

public string Text { get; set; }



[MapField("completed")]

[DataMember]

public bool Completed { get; set; }



[MapField("tags")]

[DataMember]

public string Tags { get; set; }



[MapField("parentid")]

[DataMember]

public DateTime? ParentId { get; set; }




[IgnoreDataMember]

[MapField("userid")]

public int UserId { get; set; }

}



ParentId, this is a hint at the only idea that broke through my protective barriers and was implemented later. (hello, gmail) As we can see, the class is very simple, but hung with attributes. Attributes of the form [DataMember], hint that this data will go to the Silverlight application, and [IgnoreDataMember] - respectively, that they will not. [MapField ("XXX")] is the mapping of the class fields to the record fields in the database. Frankly, only because of this magic inside Rsdn.Framework in due time I switched to c #.

')

The main mistake at this stage was to create your own bike authorization / user registration, although there are ready-made ASP.Net mechanisms and so on. Why I did not use them, I do not know. 80% of the entire code and the remaining additional labels were created just for the sake of authorization and registration ... I repent, but it is.



Code



This stage is absolutely uninteresting, here is the usual C # with its framework, the code is written easily and quickly. Everything is great. But as always, there are gags. For example, when “restyling” (creating a new style) different elements, their behavior is quite adequate and generally corresponds to what you write, but ListBox has an annoying bug. Its children do not want to occupy the entire width of the parent, and occupy exactly as much as they need. The dirty hack defeated them. Alas, not a clean xaml solution. Or, for example, there is no DoubleClick'a, this is already serious, but it is completely solvable .



We play. We are testing.



As always, this is the longest stage, when a lot of brilliant ideas appear that need to be nipped in the bud. As well as all sorts of confusions with neponyatki that need to be corrected. It was at this stage that I was given an idea “like Google’s”. Make tasks hierarchical. Here immediately appeared hacks with Drag'n'Drop (I’ll tell about Drag'n'Drop in Silverlight, if it is interesting, separately) and all sorts of illogicalities. But everything seems to be defeated, I proudly put version 1.0, and give the project to the public.



TagTodo. Judge



So, the description of what I got. Features.

1. Saving tasks online, the ability to access them from anywhere.

2. For each task tags are hung, which can then be filtered. Tags are automatically colored based on the content. Tags can be deleted and dragged.

3. Tasks can be divided into subtasks, and they, in turn, too. And arrange the tasks in a hierarchy.

4. The entire list can be exported as XML.

5. Speed ​​and simplicity. When you write a task, separate the tags from the main text with a backslash '\'. And by pressing the enter button, the task will be added, as well as the typed tags will appear. For example, "Wash the elephant \ car wash, the elephant." The task “Wash the elephant” with two tags “wash” and “elephant” will be added.

6. To add a task as a child, simply select the future dad and start the task name with a backslash '\'. However, then no one will interfere with doing the same with a simple drag and drop.

7. Funny time-money tag. He will write you how much time has passed since the creation of this task. (see picture above)



Come on , play. You will need Silverlight 3.

Just want to warn . The registration screen is rather illogical, time is short. By clicking on the registration button, you will be able to enter your mail in addition to your name and password. If you click on this button again, the mail (if everything is fine, the login is not busy, there is such a mail, etc.) the confirmation link will be sent. As soon as you confirm your mail. The account will be unlocked and you can play around with a tudushka.



PS My first topic on Habré, I wanted to whitewash the label (tag?) "July". It turned out or not - to judge you. Ideas, improvements are welcome, although their brain is full.

Source: https://habr.com/ru/post/67148/



All Articles